how to create filter condition for a business rule using rest API

Deepali5
Tera Contributor

Hello,

I am trying to create a business rule for Incident table from my third party tool using rest API posting to

"sys_script" table.

I am using following payload = { 

"name": "AutoUpdates",
"action_update": "true",
"action_delete": "true",
"active": "true",
"advanced": "true",
"collection": "Incident",
"filter_condition": "sys_updated_bySTARTSWITH" + username + "^EQ",
"when": "after",
"order": "100",
"script": "myscript ...... "
}
After posting I get success 201 and I can see this business rule record created in servicenow UI with all  the fields except filter condition.
So How can I create a filter condition using rest API? Is there a separate table for filter condition of a business rule?
Would appreciate the help,
Thanks

 

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Deepali5 

the condition field requires an encoded query

this looks fine

"filter_condition": "sys_updated_bySTARTSWITH" + username + "^EQ",

Did you try with some simple condition?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Deepali5
Tera Contributor

Hi Ankur,

Thanks for the reply.

I did not try with any other simple filter condition.  How do I do that?

I saw this sys_updated_bySTARTSWITH" + username + "^EQ", in 

 a template when I manually created the business rule, so I am using the same in rest API.

Could you please advise as how to write simple filter condition ?

Appreciate your help

Regards