- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2020 11:33 PM
Hi.
I have to transfer contents of a Client Script in a Business Rule.
The following statements of the client script, i dont know how to convert to a business rule:-(g_form.getActionName()=='sysverb_update_and_stay' || g_form.getActionName()=='a831a099dbfe1b8057a9ffe61d961945' || g_form.getActionName()=='sysverb_update' ).
I am unable to find the relevant BR functions. Please help.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2020 12:15 AM
if i look into your client script , i can see the most of the action name works for update operation. so if you will use the business rule on update operation ( set update as true) then it should work. no need to check action name.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2020 11:36 PM
Hi,
I understand. But what is your use case? Because this is something which happens when you click on UI Action.
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-02-2020 11:36 PM
why business rule ? may i know the use case ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2020 12:08 AM
Thanks for responding harshvardhan and ashutosh. I am not sure what you mean by use case.
I have a button which adds additional comments and I have some BR which get triggered when adding the comments to the incident form. So when the comments get added, the br get triggered. BUT THE CLIENT SCRIPT DOESNT GET A CHANCE TO TRIGGER BECAUSE THE BR GOT TRIGGERED BEFORE THAT. So I am trying to copy the client script contents to a third BR so that when BR runs, the content of CS which got skipped, runs as well.
Below is if conditions of the CS code and BR code I am trying to use in:-
Client Script:
if(getView()=='ess' && (g_form.getActionName()=='sysverb_update_and_stay' || g_form.getActionName()=='a831a099dbfe1b8057a9ffe61d961945' || g_form.getActionName()=='sysverb_update' ))// && g_form.getActionName()=='sysverb_update')
g_form.setValue('u_source','Portal');
Business Rule:
var view_name='';
if (gs.getSession().isInteractive()) {
var map = gs.action.getGlideURI().getMap();
if (map.get('sysparm_view') != null) {
view_name= map.get('sysparm_view').toString();
}
}
gs.log('ASHI View: '+view_name);
if(view_name == 'ess' && /*Here will come the client script lines*/){
current.u_source = 'Portal';
}
I should also mention here that the code for fetching view isnt working either.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2020 12:14 AM
Hi,
Are you testing it in proper view? Silly but please check it once.
Thanks,
Ashutosh