Need to map record producer variables on a form to the record created form fields

Arjun Reddy Yer
Mega Sage

required help @Ankur Bawiskar @Vasantharajan N 

 

Once the record producer form is submitted it is creating WVIR0001054 record in the backend as the record producer is created under application: Workplace Visitor Management.

 

Now I need to map the variables of the record producer form to the record WVIR0001054 that is creating in the back end.

 

I tried with below scripts in the Record Producer Script option but it's not working as expected

current.first_name = producer.visitor_name;

 

tried with business rule as well with the below script in the record WVIR0001054 

After Business Rule 

Insert Checked

 

(function executeRule(current, previous /*null when async*/) {
    var mapping = {
        'visitot_first_name'  : 'first_name'; 
    };

    var qa = new GlideRecord('question_answer');
    qa.addQuery('table_sys_id', current.sys_id);
    qa.query();

    while (qa.next()) {

        var variableName = qa.question.name.toString();

        if (mapping[variableName]) {

            current[mapping[variableName]] = qa.value.toString();
        }
    }

    current.update();

})(current, previous);

 Multirow Variable Set: Table Name: sc_cat_item_producer

ArjunReddyYer_0-1795615492938.png

ArjunReddyYer_2-1795615660557.png

 

 

Record Form: Table Name: sn_wsd_visitor_visitor_registration

ArjunReddyYer_1-1795615579822.png

Here the variables need to map with the fields on the form

 

And as per the requirement approvals also need to be created like 1st Request Item need to be created and need to go for approval once approved then the record WVIR0001054 need to be created.

0 REPLIES 0