Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Portfolio does not populate onto the Idea form - Record Producer

Vaishnavi35
Tera Guru

Hi,

I have created a Record Producer with "select box" variable. I have added choices manually.

Vaishnavi35_0-1717584359953.png

 

On the "Idea" form we have "Portfolio" field. Its a reference field.

Vaishnavi35_1-1717584422487.png

 

 

Whatever value I am giving on the Record producer I want it to go on the Idea form.

current.portfolio = producer.portfolio; - this script does not work on the RP record
 
"Map field" is also not working.
 

 

 

 

Thanks,

Vaishnavi

 

1 ACCEPTED SOLUTION

AshishKM
Kilo Patron
Kilo Patron

Hi @Vaishnavi35 , 

As per all details given here, it looks that the local select box value ( from question_choice ) table are mapped with portfolio field on Idea table which is giving this overall issue becuase selec box value's has different sys_id than Profile [ pm_profile ] tabe.

 

Workarround :

You can write gliderecord query over pm_profile table and get the profile record sys_id based on selected profile on record producer using the below code.

 

current.portfolio = getPortfolio(producer.u_portfolio);

// Funtion to  return selected portfolio record's sys_id
function getPortfolio(protf){
 var grPorfolio = new GlideRecord("pm_portfolio");
     grPorfolio.addQuery("name", portf );
     grPorfolio.query();
     if(grPorfolio.next()){
       return grPorfolio.sys_id;
     } // if closed
} // function closed

 

AshishKM_0-1717607633264.png

 

-Thanks,
AshishKM

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

View solution in original post

6 REPLIES 6

Rakesh41
Tera Contributor

@Vaishnavi35 ,

Please try to pass the sys_id of the portfolio's from your record producer.

AshishKM
Kilo Patron
Kilo Patron

Hi @Vaishnavi35 , 

As per all details given here, it looks that the local select box value ( from question_choice ) table are mapped with portfolio field on Idea table which is giving this overall issue becuase selec box value's has different sys_id than Profile [ pm_profile ] tabe.

 

Workarround :

You can write gliderecord query over pm_profile table and get the profile record sys_id based on selected profile on record producer using the below code.

 

current.portfolio = getPortfolio(producer.u_portfolio);

// Funtion to  return selected portfolio record's sys_id
function getPortfolio(protf){
 var grPorfolio = new GlideRecord("pm_portfolio");
     grPorfolio.addQuery("name", portf );
     grPorfolio.query();
     if(grPorfolio.next()){
       return grPorfolio.sys_id;
     } // if closed
} // function closed

 

AshishKM_0-1717607633264.png

 

-Thanks,
AshishKM

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution