HRSD Agent Workspace g_aw.openrecord() question

DrDinu
Tera Contributor

Hello all,

 

Is it possible to auto populate a couple of fields on the target record with the aw_openRecord() ? 

I've spotted that an OOTB ui action is already doing that (Create HR Case on the Interactions table):

 

Here's the OOTB Workspace Client Script:

 

 

function onClick(g_form) {
	var USER = g_form.getValue('opened_for');
	var NEW_RECORD = '-1';
	var TABLE_HR_CASE = 'sn_hr_core_case';
	g_aw.openRecord(TABLE_HR_CASE, NEW_RECORD, {userId: USER, subjectPersonIdOnCase: USER});
}

 

 

But when I try to add more fields it doesn't auto populate like the Opened For and Subject Person.

Anyone had this issue before and found a solution?

Thanks.

8 REPLIES 8

Community Alums
Not applicable

Thank you but that doesn't answer the question.

I have the same issue, and I think unfortunately it's logic on the case_creation UI page that handles the opened for and subject person population. The UI page doesn't have any logic to handle populating any other fields.

Craig Steel - F
Tera Guru

I know this is likely too late to help with your specific issue, but this may help others who are looking for it in the future.  The solution to your ask is as follows:

Utilize the query functionality in your openrecord statement.  This is based on the assumption that you are starting from a record you want to duplicate ... but should work with static values in place of the g_form.getValue.

 

g_aw.openRecord(<TABLE NAME HERE>, "-1", { query: "parent=" + g_form.getValue('parent') + "^field2=" + g_form.getValue('field2') + "^field3=" + g_form.getValue('field3') + "^field4=" + g_form.getValue('field4')});

 

I'm sure there is a length limit on how long the query string ends up resolving to, but I've used this with reference fields and string fields with no problems.  Note the "^" at the beginning of the 2nd, 3rd and 4th query clauses.