How to set assigned person in user field on time card record

mania
Tera Contributor

Hi,

 

We have Time card related list in incident form so once i click on new on time card in related list, whoever assigned person in incident form it will set that same person in user field in time card record.

Can anyone please help on this and provide me the steps, It will be usefull.

 

mania_2-1719484237655.png

 

mania_1-1719484157825.png

Thanks!

4 REPLIES 4

Mark Manders
Mega Patron

Wouldn't it be better to fill the record with the current logged in user (gs.getUserID())? 

Otherwise some one is creating timecards for someone else.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

mania
Tera Contributor

@Mark Manders 

Thanks for Responding!
The person who is assigned a ticket, It should come by the default on the user field in the Time card record.

Thanks!

In that case a client script finding the assigned to on the related record and fill it should do the trick.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Dnyaneshwaree
Mega Sage

Hello @mania ,

 

By using "show XML" option in form context, please check is there any field present which values comes from the parent incident form like incident no.

If there parent incident number or parent field present in the related record of time card then , use onload client script on time card table and use below logic and update the field names as per your requirement:

function onLoad() {
    var incidentNo = g_form.getReference('parent', setincidentNo); // check which field contains incident number and update name of parent.
      function setincidentNo(incidentNo) {
var assignedTo = incidentNo.assigned_to;  // update it accordingly. you can also try like incidentNo.number.assigned_to
        g_form.setValue('user', assignedTo);
    }
}



Thank You!!

Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru