How to display few checklists in a HR case based on the category selected in a record producer

Arpita Priyadar
Mega Contributor

Ex-

There is a "create a HR case" record producer.when I will raise a request with category value isthen 2 checklist testA1 and testA2 will display in the HR case.

if I will raise a request with Category value is B then 2 checklist  testB1 and testB2 will display in the HR case

Category is lookup selectbox and this field values are dependent on another field lookup selectbox ie what is this request regarding

1 ACCEPTED SOLUTION

Hello @Arpita Priyadarshini  ,

then lets try this we have two tables where check lists and check list items are stored .

1) Check list - where your check list can be created manually .

back end name -checklist.LIST

2) Checklist Item - where check list items are stored 

back end name :checklist_item.LIST

 

find_real_file.png

find_real_file.png

So you can write an after insert BR on hr case table and get the category through script and check if its category A insert a record in checklist table and under that record again insert check list items through script with exact mappings .

Main thing is you need to map document ID field which stores the HR case sys_id.If you try to map it then automatically the check list will be inserted 

sample script 

var gr= new GlideRecord('checklist');
gr.initialize();
gr.document=current.sys_id;
gr.owner =gs.getUserID();
gr.table="sn_hr_core_case";
var checkid = gr.insert();

var arr=['test1' ,'test2']; // store your check list item names
var orderCount=0; 
for(var i=0; i<arr.length; i++)
{
var chck = new GlideRecord('checklist_item');
chck.initialize();
chck.checklist=checkid;
chck.name=arr[i];
chck.order=orderCount++;
chck.insert();
}

Not sure if it will work but worth giving a try .

Please mark my answer correct if it helps you

 

View solution in original post

7 REPLIES 7

abirakundu23
Mega Sage

Hello @Sandeep Dutta / @Mohith Devatte / @Ankur Bawiskar / All,

Could you please look into this ?

 

Hello @Arpita Priyadarshini , @absnow 

you can do one thing.

1) Create two HR SERVICES and tag this record producer to both HR services but with different categories 

Tag that record producer to an HR service like below .

In first HR service give category A and in second hr service give Category b and tag your create HR case record producer to it in record producer field highlighted in below picture.

 

Then create your Check list accordingly using checklist section in the HR service(marked in blac in below screenshot)

find_real_file.png

Please mark my answer correct if it helps you

 

Arpita Priyadar
Mega Contributor

@Mohith Devatte ,

I have already tried  the approach you have mentioned but it was showing that the record producer is already in use on one or more other active HR services, so Invalid insert, it's showing

Hello @Arpita Priyadarshini  ,

then lets try this we have two tables where check lists and check list items are stored .

1) Check list - where your check list can be created manually .

back end name -checklist.LIST

2) Checklist Item - where check list items are stored 

back end name :checklist_item.LIST

 

find_real_file.png

find_real_file.png

So you can write an after insert BR on hr case table and get the category through script and check if its category A insert a record in checklist table and under that record again insert check list items through script with exact mappings .

Main thing is you need to map document ID field which stores the HR case sys_id.If you try to map it then automatically the check list will be inserted 

sample script 

var gr= new GlideRecord('checklist');
gr.initialize();
gr.document=current.sys_id;
gr.owner =gs.getUserID();
gr.table="sn_hr_core_case";
var checkid = gr.insert();

var arr=['test1' ,'test2']; // store your check list item names
var orderCount=0; 
for(var i=0; i<arr.length; i++)
{
var chck = new GlideRecord('checklist_item');
chck.initialize();
chck.checklist=checkid;
chck.name=arr[i];
chck.order=orderCount++;
chck.insert();
}

Not sure if it will work but worth giving a try .

Please mark my answer correct if it helps you