0 votes

Hello,

Is it possible to do alert message from a workflow? i know there's other workaround using Ajax calls and manipulation on MacroEditS, but i want to make use of functionality FieldModified to trigger certain functionality, and after execution i want to show some alert.

I noticed on some workflows on SVN there's command like UserSession.ExecuteCommand('alert("Hello World")'), but not sure if it's related to certain versions of Efficy, because i tried it on 10.2 and 2014 6640 but not working. any ideas?

Please advise.

Best Regards.

asked in WorkFlow / Serverscript by (559 points)

2 Answers

0 votes
Best answer

The method UserSession.ExecuteCommand allows you to inject custom JavaScript code into the <script> block of the response. It depends on your action (e.g. RefreshOpener) if the result is properly executed. In some conditions, it's possible that you only get to see the message (in case of an alert) in the response of the next request.

It's quite hard to pinpoint if you don't specify your workflow code and the calling context.

It should work in all Efficy versions.

Example:

function BeforeCommitComp(editComp, inserted) {
    UserSession.ExecuteCommand('alert("Finished")')
}
answered by (6.8k points)
edited by
Hello Kristof,

I would like to use it in WF on trigger "BeforeCommitComp", so i can do at the end something like: UserSession.ExecuteCommand('alert("Finished")')

is this possible please?

Thank you.
Best Regards.
I just tried it on Efficy 10.2 with only these 3 lines in workflow. I do get the alert when I apply or OK a company.

function BeforeCommitComp(editComp, inserted) {
    UserSession.ExecuteCommand('alert("Finished")')
}
Hello Kristof,

indeed it did :). i've tested on my local and works, it must be somethin i missed on the production WF, i will check again.

Thank you a lot.
Best Regards.
0 votes

You can also use this old school method in your workflow:

LinkSession.ExecuteCommand("javascript:alert('message');"); 
answered by (273 points)
1,166 questions
1,424 answers
1,716 comments
325 users