Need a Wait Script for a condition

dvientos
Kilo Explorer

Hey everyone,

 

I'm not a scripter but I am looking for a script which I can place in a workflow "Wait for Condition".

 

I am trying to have a script meet the condition of requiring my change management fields Change Plan, Backout Plan, Test Plan be completed before the change can move to the next level which is for approval. If a Change Plan, Backout Plan and Test Plan the script should notify the requestor via a popup screen that these fields need to be completed before it can move on to the next step of the workflow.

 

Any help would be greatly appreciated. If I need to better explain please let me know.

 

Thanks,

 

Domenic

11 REPLIES 11

kyleb13281
Kilo Expert

Your "Wait for Condition" in the workflow will control the process for that change.


The pop up for the user should be controlled via client script.


Utiliz:


gs.addInfoMessage(' these fields need to be completed before it can move on to the next step of the workflow');



GlideSystem - ServiceNow Wiki


Don't I have to have a script within the wait condition to tell it to look for the specified fields be completed? I need to have the specified fields completed before it moves to the next step of the workflow.



Where do I place the client script? As I mentioned not a scripter also not a developer...



thank you very much for your input!



domenic


Regarding the wait condition in the workflow. no scripting is necessary, simply adjust the condition via the drop down. Use the name's of your target fields in place of "sponsor".



Capture1.PNG




The client script is a little more involved. But, luckily, just a little:


Type: OnSubmit



Script should work by substituting your field names and your custom error msg:



function onSubmit() {


  if (g_form.getValue("field_1") == "" || g_form.getValue("field_2") == "" || g_form.getValue("field_2") == "" ||){


                  gs.addInfoMessage('Your error message here');


    }


}


Please forgive me being such a novice and asking what may be silly questions.



Where do I insert the script? I hate to ask but I just need brief step by step.



Now as far as the condition item.. Viola! It worked and its awesome!!!! Just need to get the above client script working.



Thank you!



Domenic