Live Profile

Darshana2
Tera Contributor

Create a fix script that from the live_profile table goes into the sys_user table and finds a match on name (name on user record = name on live profile record) and sets the Field to that record's sys_id.

4 REPLIES 4

Marcus Walbridg
Tera Expert

I am assuming that you want to set the 'name' field on live_profile records to be the sys id of the User record it is referencing.

 

You already have the sys id of the user in the 'document' field.  It is a reference to the user record.  However you could make a fix script to do this. You do not even need to query the sys_user table.

 

Just take the values in the 'document' field in the live_profile records and put it in the 'name' field.

Darshana2
Tera Contributor

What is the fix script for fetching the data

You would want to get all of the live profile records to be updated, loop through them, and set the field to what you want & update().

 

You could do something like this:

 

var liveProfiles = new GlideRecord("live_profile");

 

liveProfiles.addQuery('active', true);

while(liveProfiles.next()) {

    //set the name to equal the value of 'document' field

    liveProfiles.name = liveProfiles.document;

    liveProfiles.update();

}

 

I didn't actually try this, but you would do something very similar.  I am just querying for all the live_profile records that are active, looping through them, and setting the 'name' to be the value of the 'document' field.  

Darshana2
Tera Contributor

we have  fetching the data from user table not from 'document' field for that we have to write fix script