How can I dot walk in for a field on create a record action

Chandra18
Mega Sage

Hello Experts,

Chandra18_1-1746199980301.png


As per attached image, I want to set user.email = user email coming from a action.

on red i want user.email = on green it is passing the user email. (it is correct).

how can I ?

thanks

5 REPLIES 5

Hitesh Patel1
Tera Contributor

Hi Chandra,

 

I am not following what you are trying to achieve. I guess you have a catalog item where a user can submit a request to add themselves to a group of their choice post approval? Can you share more details about the ask?

 

Regards,

Hitesh Patel

Hi @Hitesh Patel1 ,

I have created a action and this action fetching a user email from a azure group.
I want to create a record in sys_user_grmember table (OR you can say adding the member in service desk group).

you already know if we are adding a member in group both field are reference.
but I am fetcing email from azure and the same member already exist in sys_user table, how can create a group member record by email.

Ankur Bawiskar
Tera Patron
Tera Patron

@Chandra18 

you cannot set field value using create record

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Chandra18
Mega Sage

It is working ðŸ˜Š now
I have created a individual script action with follow script.

(function execute(inputs, outputs) {
var useremail = inputs.userEmail;
  var group = inputs.group;
  var userGr = new GlideRecord('sys_user');
  userGr.addQuery('email', useremail);
  userGr.query();
  if (userGr.next()) {
    var gr = new GlideRecord('sys_user_grmember');
    gr.initialize();
    gr.setValue('group', group);
    gr.setValue('user', userGr.sys_id);
    gr.insert();
    outputs.recordsysid = gr.sys_id;
  }
})(inputs, outputs);

  
Thank you!