Need to populate the parent number to child record

suuriya
Tera Contributor

Hi Community,

 

I have a requirement, wanted to populate the parent number in related record.

Parent table (pm_project) and child table (pm_project_phase) once i create a parent record then in related list there is section called project phase and when i click on new and create new record then record number of pm_project needs to populate in pm_project_phase record.

 

Here when i click new button it will show only description and short desc fields only in form after i submit this form it will show something like the down image (all field of project phase will be visible)

 

So I created a Before insert BR in pm_project_phase table (child) and in script i used current.parent =current.parent.number; but it didn't work tried like parent is the backend name of the field where i need to set value

so i also used this like in image in parent record field it is showing the empty value ....

suuriya_0-1707895731749.png

suuriya_1-1707895813583.png

In child table there is field called parent record (backend name parent) in this field i need to populate the number of the parent

 

Please help me with the script how we can achieve this

 

1 ACCEPTED SOLUTION

Hello @suuriya 

try using this:

current.parent = current.u_parent_project + ''

current.update()

because as I can see only your Custom parent project field is populated.Hope that this helps you!

If the provided information answers your question, please consider marking it as Helpful and Accepting the Solution so other community users can find it faster.

All the Best,
Stefan

View solution in original post

7 REPLIES 7

Stefan Georgiev
Tera Guru

Hi @suuriya ,

try using async Business rule and your parent record is a reference field and it expects an ID not a number so you should populate it with the ID of the pm_project record.  That is why you are getting this message from SN utils, it can not find the record to display.

StefanGeorgiev_0-1707896795592.png

Hope that this helps you!

If the provided information answers your question, please consider marking it as Helpful and Accepting the Solution so other community users can find it faster.

All the Best,
Stefan

HI @Stefan Georgiev ,

 

Thanks for your reply

 

I tried like you said changed it to async BR and in script i used 

suuriya_1-1707897765835.png

 

adding sysid but it didn't worked no value is populated

Hello @suuriya 

try using this:

current.parent = current.u_parent_project + ''

current.update()

because as I can see only your Custom parent project field is populated.Hope that this helps you!

If the provided information answers your question, please consider marking it as Helpful and Accepting the Solution so other community users can find it faster.

All the Best,
Stefan

HI @Stefan Georgiev ,

 

Thanks it worked populated the parent record but before async i have used before BR and in action part i have set the value of project type using dot walking method (project type field will be same as the type of parent project) but now it is changed to async project type field is not getting populated.

 

Any suggestion on this...