Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

UI BUILDER: How to take the sys id from the newly created record with the created record data

fabrizio95360
Tera Expert

Hi Developer,

I'm creating a record in a table via the client script using the created record data method, and I need the sys_id of the newly created record, is there a way to get it in the client script?

 

this is my code in client script:

 

function handler({api, event, helpers, imports}) {
    let objSelectedRecords = api.state.jsonSelectedRecords; //JSON.parse(api.state.jsonSelectedRecords);
        let objFormValues = JSON.parse(api.state.jsonFormValue);

        if (objFormValues.bulk_case) {
            let tableBulkCase = 'x_nttdi_gosign_con_gosign_bulk_case';
            let fieldsBulkCase = '';
            fieldsBulkCase += `source_table=${objSelectedRecords.table}^`;
            fieldsBulkCase += `source_record=${objSelectedRecords.sys_ids[0]}^`;
            fieldsBulkCase += `case_source=${objSelectedRecords.sys_id_source}^`;
            for (const propertyBulk in objFormValues) {
                fieldsBulkCase += `${propertyBulk}=${objFormValues[propertyBulk].value}^`;
            }
            fieldsBulkCase = fieldsBulkCase.slice(0, -1);
            api.data.create_record_bulk_case.execute({
                table: tableBulkCase,
                templateFields: fieldsBulkCase,
                useSetDisplayValue: false
            });

//I want to get the sys_id of created record
        }

 

 

1 ACCEPTED SOLUTION
7 REPLIES 7

Hi @ersureshbe ,

 

I've managed to get sysID from this path of Glide Record data resource:

 

api.data.<your glide query data resource>.nowRecordFormBlob.gForm.getSysId();

 

Hi, Is that code working? If not try with glideAjax to test that.

Regards,
Suresh.

@ersureshbe ,

 

yes it's working like a charm.