new quote alert after insertion via API  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

new quote alert after insertion via API

Postby JuiceyBrucey » Sat Feb 25, 2023 9:10 am

After I insert a new quote via the API, I would like some sort of alert, popup, or other attention getting alert, that tells the JIWA user that there is a new order pending.
Is there any such thing in JIWA?
I have tried inserting quotes manually etc, but there does not seem to be any thing like an alert to get the attention of the JIWA user.
Thank you.
Cheers
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 132
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Re: new quote alert after insertion via API

Postby Mike.Sheen » Mon Feb 27, 2023 12:00 pm

JuiceyBrucey wrote:After I insert a new quote via the API, I would like some sort of alert, popup, or other attention getting alert, that tells the JIWA user that there is a new order pending.
Is there any such thing in JIWA?
I have tried inserting quotes manually etc, but there does not seem to be any thing like an alert to get the attention of the JIWA user.
Thank you.
Cheers


ToDo's in Jiwa will cause a toast notification to appear.

You can very simply in a plugin handle the quote's business logic save end handler and create a to-do.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: new quote alert after insertion via API

Postby JuiceyBrucey » Mon Feb 27, 2023 1:26 pm

Thank you for your reply.
Is there any tutorials related to this topic?
I have had a look and cant find anything yet.

Do the ToDo notes go into the IN_Notes table?
Thank you.
Cheers
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 132
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Re: new quote alert after insertion via API

Postby JuiceyBrucey » Mon Feb 27, 2023 1:44 pm

Found the tutorial. I will get back to you if I need help.
Thanks again
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 132
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Re: new quote alert after insertion via API

Postby SBarnes » Mon Feb 27, 2023 3:37 pm

Creating a to do is not hard the code below for example will do this, but to fire off when a quote is added is a bit more involved, in this case unless you have .net programming experience and are fairly familiar with Jiwa it may be better to ask Jiwa for a quote to provide the functionality.


Code: Select all
 public static void SendInternalMessage(Manager manager, List<string> toList, string subject, string body)
        {
            foreach (string usr in toList)
            {
                JiwaFinancials.Jiwa.JiwaApplication.JiwaToDos.ToDo toDo = manager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaApplication.JiwaToDos.ToDo>(null);
                toDo.CreateNew();
                toDo.AssignedTo.ReadRecordByUsername(usr);
                toDo.Subject = subject;

                toDo.Body = body;



                toDo.ReminderPredefinedSetting = JiwaFinancials.Jiwa.JiwaApplication.JiwaToDos.ToDo.ReminderPredefinedSettingType.WhenDue;
                toDo.ReminderSpecificDateTime = DateTime.Now;
                toDo.ReminderEnabled = true;
                toDo.Save();
            }
        }
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: new quote alert after insertion via API

Postby JuiceyBrucey » Mon Feb 27, 2023 3:47 pm

Mike.Sheen wrote:
JuiceyBrucey wrote:After I insert a new quote via the API, I would like some sort of alert, popup, or other attention getting alert, that tells the JIWA user that there is a new order pending.
Is there any such thing in JIWA?
I have tried inserting quotes manually etc, but there does not seem to be any thing like an alert to get the attention of the JIWA user.
Thank you.
Cheers


ToDo's in Jiwa will cause a toast notification to appear.

You can very simply in a plugin handle the quote's business logic save end handler and create a to-do.


Is there any examples of this that I can follow?
I have found the database table that the ToDos exist in and manually inserted one, but I cannot get any notification to pop up.
I have modified the reminder date via SQL to try it out, but nothing yet.
Any advice would be great.
thank you.
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 132
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Re: new quote alert after insertion via API

Postby SBarnes » Mon Feb 27, 2023 3:52 pm

Go to system settings -> system configuration -> system and put a value in the poling interval setting then log out and back in but you shouldn't be adding to the tables directly via sql, you should use the Jiwa objects as in the code I posted.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: new quote alert after insertion via API

Postby JuiceyBrucey » Mon Feb 27, 2023 6:35 pm

SBarnes wrote:Creating a to do is not hard the code below for example will do this, but to fire off when a quote is added is a bit more involved, in this case unless you have .net programming experience and are fairly familiar with Jiwa it may be better to ask Jiwa for a quote to provide the functionality.


Code: Select all
 public static void SendInternalMessage(Manager manager, List<string> toList, string subject, string body)
        {
            foreach (string usr in toList)
            {
                JiwaFinancials.Jiwa.JiwaApplication.JiwaToDos.ToDo toDo = manager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaApplication.JiwaToDos.ToDo>(null);
                toDo.CreateNew();
                toDo.AssignedTo.ReadRecordByUsername(usr);
                toDo.Subject = subject;

                toDo.Body = body;



                toDo.ReminderPredefinedSetting = JiwaFinancials.Jiwa.JiwaApplication.JiwaToDos.ToDo.ReminderPredefinedSettingType.WhenDue;
                toDo.ReminderSpecificDateTime = DateTime.Now;
                toDo.ReminderEnabled = true;
                toDo.Save();
            }
        }


I am close to making a variation of this work but I cannot access the Manager class.
How would I do that?
I usually code in PHP etc, but I am learning C# while I am doing this. I am doing tutorials etc all day. So I wont be asking dumb questions forever. But I need to get past this issue ASAP and your help is much appreciated.
thank you.
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 132
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Re: new quote alert after insertion via API  Topic is solved

Postby Mike.Sheen » Mon Feb 27, 2023 6:50 pm

JuiceyBrucey wrote:I am close to making a variation of this work but I cannot access the Manager class.
How would I do that?


It's a property of all our business logic objects, forms, items, collections.

If you are coding inside a plugin, it's also accessible via the passed Plugin parameter of most plugin entry point methods (eg: Setup)

Attached is a plugin which creates a Todo whenever a quote is created, and assigns it to the "Admin" user.
Attachments
Plugin Create ToDo when quote created.xml
(11.41 KiB) Downloaded 63 times
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: new quote alert after insertion via API

Postby SBarnes » Mon Feb 27, 2023 6:51 pm

If you have created a plugin to include the code which is I what I have assume you have done then the setup methods get handed a plugin which has a manager as a property as do the Business host / business object or any of the forms if you are doing a form plugin.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Next

Return to Technical and or Programming

Who is online

Users browsing this forum: Google [Bot] and 32 guests