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

suuriya
Tera Contributor

HI @Stefan Georgiev 

Please see attachment 

suuriya_0-1707899054960.png

i wanted to populate both project type and parent record

What are you using to populate the project type, can you add an screenshot of the script and the options for the type.

HI @Stefan Georgiev ,

 

I have written 2 different BR's to achieve this....now it is working as expected

Thanks