Help creation of a new contact

Community Alums
Not applicable

Hi all, 

In virtual agent, I have a topic where users are asked to create a contact. They are asked all the question and from their answers, a new contact should be created. To achieve this, I have used the record action utility and added the fields to show the input variable values.

Dev86_0-1723462145460.png

At the moment, however, I am encountering an error, it's creating the contact, but on the new contact record, the account field is not populated, only the other ones. 

Any ideas? 

This is my script: 

 

(function execute() {
var gr = new GlideRecordSecure('customer_account');
gr.addQuery('number',vaInputs.account_number);
gr.query();
if(gr.next())
{
gs.info('Test'+vaInputs.account_number);
gs.info('Test'+gr.sys_id);
}
vaVars.account=gr.sys_id;
})()
1 ACCEPTED SOLUTION

@Community Alums 

 

Yes! You have used GlideRecordSecure which will ensure that the ACLs are enforced to prevent unauthorized data access. Refer https://www.servicenow.com/community/developer-blog/gliderecordsecure-gliderecord-vs-gliderecordsecure-when-to-use/ba-p/2539299

 

You can probably give this a try with GlideRecord and see if that works.


Please mark this response as correct and helpful if it assisted you with your question.

View solution in original post

5 REPLIES 5

Amit Verma
Kilo Patron
Kilo Patron

Hi @Community Alums 

 

I could see that you are assigning the sys_id to vaVars.account variable though the variable you have mapped in the screenshot is vaVars.account_number. 

 

Can you please try assigning the sys_id to vaVars.account_number instead of vaVars.account and see if it works ?

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Community Alums
Not applicable

Hi @Amit Verma I tried that, but still didn't work

Community Alums
Not applicable

@Amit Verma Could it be the fact that this is requested from anauthorized users? 

 

@Community Alums 

 

Yes! You have used GlideRecordSecure which will ensure that the ACLs are enforced to prevent unauthorized data access. Refer https://www.servicenow.com/community/developer-blog/gliderecordsecure-gliderecord-vs-gliderecordsecure-when-to-use/ba-p/2539299

 

You can probably give this a try with GlideRecord and see if that works.


Please mark this response as correct and helpful if it assisted you with your question.