This is from ServiceNow Witchdoctor's channel. Found quite a few things that are worth sharing, though being very small items these tips helped me learn and I will possibly apply them when needed:
The idea is to create a record (say incident) and associate another record (say new incident task) to it.
A typical SN person like me would opt for writing scripts on the record producer configuration record - in the script field that's present there (the one that runs after the rp submission).
BUT, ServiceNow has evolved tremendously over time, so it's high time we look for the best possible/relevant method.
The way this was handled:
Create the record producer (duh!)
Familiarize with this wonder-table called 'sc_item_produced_record'
Write a flow using flow designer - to run on the target record creation (say incident).
Lookup record on the sc_item_producer_record that matches with the target record sys_id - this way we will know if there is an incident created from this record producer.
Create the desired new record (say incident task) and associate it with the incident.
Feel content that you accomplished this with such minimal coding.
Item Producer Records table:
This table holds records that are created through a record producer.
May come in handy to identify if incidents or any task records were created by agents or via a record producer.
This can be utilized to segregate task records based on their source of creation and add validations accordingly.
Things i learned:
You don't have to write scripts for everything :)
'sc_item_produced_record' table helps identify task records originating from record producers
The 'Get catalog variables' action on flow designer also works for non-RITM records, in this case, it worked for the incident record.
The record producer name needs to be put in the place of 'Template' in the 'Get catalog variables' action.
'Look-up records' action is a very powerful replacement for glideRecord; manipulations can be done based on the 'count' it returns.
Testing a flow designer is making real-time updates :)
Comments