Here is a solution to trigger ProcessFlow Integrator (PFI) from a Personalized Script for Lawson Smart Office (LSO) using the native PF adapter. This technique is new as of LSO 9.1.3.
First, enable the PF configuration in the Smart Office Profile Editor:
Then, use Lawson.Shared.PF.Trigger to determine if Trigger Services are available:
if (PFTrigger.HasTriggerService) { // Trigger Services are available } else { // Trigger Services are not available }
PFTrigger is part of Lawson.Shared.dll:
Then, prepare the trigger:
var service = 'MyService'; var product = 'ERP'; var dataArea = 'PFTST'; var category = ''; var title = 'Test from a script'; var trigger = new PFTrigger(service, product, dataArea, category, title); trigger.AddVariable('var1', 'Hello1', 'String'); trigger.AddVariable('var2', 'Hello2', 'String'); trigger.AddVariable('var3', 'Hello3', 'String');
Then, execute the trigger:
trigger.SubmitRequest(dataArea, OnTriggerCompleted);
Then, add an event handler:
function OnTriggerCompleted(args: PFTriggerEventArgs) { if (args != null && args.IsSuccessful) { args.Response.DetailMessage args.Response.ErrorCode args.Response.InformationCode args.Response.ReturnCode args.Response.ReturnData args.Response.Status args.Response.WorkunitNumber } }
Here’s a screenshot of the result:
We can see the HTTP Request and Response with Fiddler:
For versions of Smart Office prior to 9.1.3, it’s possible to trigger PF flows using the old technique with URL. For that, you can use the PFI trigger generator.
The advantage of the new technique is the lower number of lines of code, increased readability, no need to hard-code the hostname, port, user, and password anymore, and no need to handle authentication nor logout.
That’s it!
Great improvement and really nice code. Tnks TB.
LikeLike
Gracias Juan V of Spain 🙂
LikeLike
I’ve got this error message at trigger
” The remote server returned an error :(500) Internal Server Error ”
I’m using smart office version 10.1.1
LikeLike
Hi Ahmed, it’s hard to tell what your error is about. HTTP 500 means the server has a problem, likely your PFI server needs to be restarted. Check the PFI server logs in WebSphere. Also, use Fiddler web debugging proxy to capture the trigger sent by Smart Office to PFI, and check the HTTP Response, probably not much since it’s a server problem. Hope it helps. /Tibo
LikeLike
Hi,
Can you help me with my error? I’m getting “LHC Exception Encountered” during my process flow trigger. Where can I start checking logs or something?
P.S. process flow was not executed.
LikeLike
Hi Doms, I remember having encountered that exception a couple of times, once with a login failure to populate the Inbasket, and somewhere else, but I do not remember any details. I would need to know the context of what you are doing, see the full error message, and screenshots. Otherwise, increase the log level of your process, re-trigger it to get more logs, and check the WorkUnit logs in IPA admin; you have to have the administrator role and have the Rich Client or web admin URL, e.g. http://host:81/lmdevipa/LpaAdmin/; ask your technical consultants for your environment. Otherwise ask on LawsonGuru as there are lots of IPA people there. Hope it helps. –Thibaud
LikeLike
Oh, that’s why. I actually have that error upon logging in and a ticket was already raised. I asked for help hoping that the two errors are not connected. Thanks for clarifying this Thibaud.
LikeLiked by 1 person
Hi Thibaud,
Sorry to bother you again. So just to update on the error from last time the problem was because the client has 2nd network adapters on their servers for backups, these have temporarily been disabled while looking for a resolution for the grid to work with them activated.
The error has changed now. The error now says “Unable to submit trigger”. I can email you my jscript and a screenshot of my PFI configuration in my profile editor. Would that be fine with you?
LikeLike
Set the log level to DEBUG/TRACE on the client that triggers the process flow and on the IPA server, and intercept the request/response with Fiddler or Wireshark. The more data you have the easier to troubleshoot.
LikeLike
Hi Thibaud,
As it turns out I needed to add the process flow in service definition if I want to trigger it in m3. Otherwise it can only be triggered directly in rich client.
LikeLiked by 1 person
Great. You should write a blog post about what you are doing, how to trigger a process flow for M3. There is a good chance other people need that too.
LikeLike
I need to use this function at H5 cleint. Anybody try to trigger IPA workflow from H5 Cleint using jscript?
LikeLike
Hi Ahmed, see my response at https://m3ideas.org/2014/04/19/event-hub-for-infor-process-automation-ipa/#comment-6007
LikeLike
Ahmed, check this link about how to Dispatch workunit:
Infor Landmark Technology Administration Guides > Infor Process Automation Administration Guide > Users, Tasks, Filters > Inbasket interface options and display customizations > Infor Process Automation servlets for Inbasket functions
https://docs.infor.com/help_lmrk_cloudsuite_11.0/topic/com.lawson.help.administration/com.lawson.help.lpaag-c_11.0.x/L2170639708333.html?cp=2_3_0_2_6#d22e4236
LikeLike
Hi Thibaud,
Is encrypting supported in jscript? We have a requirement wherein the username & password is being sent to the IPA database via PFTrigger. However, this field should be encrypted with a generic encryption. Generic enough to the point that the M3 transaction node in IPA can support it(still working on the list).
LikeLike
PFTrigger.HasTriggerService is returning false for me. I have performed the steps in the Profile Editor shown above. What else is needed to make trigger services available?
LikeLike