Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get Catalog Item's variable in the Workflow Activity condition?

prabhmeet
Giga Expert

Hi,

I have made a catalog item where there is a selectbox 'Request Type' with choices - create, change, access, remove.

Now I have to create the workflow for the catalog item.

For example - if choice selected is by user is 'Create'  then approval by a Group is required. If approved, it is assigned to another group for creation.

So, when I drag activity Approval- By Group on the workflow editor, how do I write the condition that request_type is create?

I am a newbie so can anyone explain how to create the workflow for the case I have mentioned? 

1 ACCEPTED SOLUTION

dvp
Mega Sage

Try this

current.variables.REQUEST_TYPE_VARIABLE_NAME == 'create'

View solution in original post

8 REPLIES 8

dvp
Mega Sage

Try this

current.variables.REQUEST_TYPE_VARIABLE_NAME == 'create'

Hi , where do I get the script option ? it only shows the condition builder option in When to run section of the activity

Hi, I have used an if condition activity for this and written the following code -

answer = ifScript();

function ifScript() {

if (current.variables.request_type == 'create' || current.variables.request_type == 'remove' || ){
return 'yes';
}
return 'no';

}

But this is not working. Can you help with this?

Try below code,

answer = (current.variables.request_type == 'create_database_value'  || current.variables.request_type == 'remove_database_value') ? 'yes':'no';