Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

configuration item owner approval on catalog item

Harry Campbell2
Mega Guru

Hello All,

I am looking for some advice on how best to approach this, I'll try and explain what I am trying to achieve.

I am trying to build a process where people request access to File Shares and the approval goes to the owner of that share.

On the request form they select the share (This is a Lookup Multiple Choice referencing the cmdb_ci_storage_fileshare table)

I can set the approver to ${configuration_item_owned_by} but I need to be able to set the configuration based on what they select in the above variable.

I know there will be an easy answer to this, I can tell I'm overlooking something.

Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee

Hi Harry,



I can't remember whether you can dotwalk a lookup select box type variable, so you may be better off going with a reference variable there. In order to send the approval to a group on your file share record you'll need to use an approval script in your approval workflow activity.


View solution in original post

3 REPLIES 3

Brad Tilton
ServiceNow Employee

Hi Harry,



I can't remember whether you can dotwalk a lookup select box type variable, so you may be better off going with a reference variable there. In order to send the approval to a group on your file share record you'll need to use an approval script in your approval workflow activity.


Thanks Brad, I have set the variable to reference the cmdb_ci_storage_fileshare table.



The approval script I have used doesn't seem to be working.....again, I'm probably missing something obvious.




var answer = [];


var fileshare = new GlideRecord("cmdb_ci_storage_fileshare");


fileshare.addQuery("owned_by",current.variables.nfs_leeds_shares);


fileshare.query();


if(fileshare.next()){


    answer.push(fileshare.owned.by);


}


Harry Campbell2
Mega Guru

Got this to work Brad thanks to your Info.



Set the variable on the catalog item to a reference field, referencing the configuration item table and used the following script to lookup the owner of the CI:



answer = (function(){  


  if (current.variables.nfs_leeds_shares.owned_by) {  


  return current.variables.nfs_leeds_shares.owned_by.toString();  


  } else return "";  


})();