We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Change of label of field only in parent table

harshvardhan_11
Giga Expert

HI,

I have a requirement where I want to change a field only on parent table, and not on its child table. Is there a possibility of doing so, without adding label for all the childs.

E.g. I have field named 'Used by' which is being used by all child tables (lets say X,Y,Z) of a table(B) which is again a child of table(A).

(A)                     - Used by

  |

(B)                   - Used by

  |

(X)(Y)(Z)- Used by

I want to change the label of field to 'Using' in   table(B), and all other table should have the field label as 'Used by'.

(A)                     - Used by

  |

(B)                   - Using

  |

(X)(Y)(Z)- Used by

I used the label related list in field dictionary and changed for label for table (B) but it also changed the label for   (X)(Y)(Z).

Is there any possibility if I can change only for table (B) without creating any extra rows in label related list for all childs.

1 ACCEPTED SOLUTION

You may want to take a look at g_form.setLabel()



This could be used from within an onLoad client script to set the field label if your table is "B". Also see g_form.getTableName().



It might look something like this:



function onLoad() {


 


  if (g_form.getTableName() == "table_b")


        g_form.setLabelOf('field_name', 'Using');


 


}


View solution in original post

11 REPLIES 11

Chuck Tomasi
Tera Patron

Short answer - you need child labels if you want them to be different from the parent.



If you change the field label on a parent table field (e.g. task.cmdb_ci) and there are no labels defined for the child tables (incident.cmdb_ci, problem.cmdb_ci,etc) they will all inherit the parent label.


Thanks ctomasi .I also found everywhere the same thing



I had more than 50 child tables for that table, so i was thinking if there would be some other solution by which we can change the label in one go without affecting other things. But I think I'll have to go by changing child labels only, or finding some other alternative.


You may want to take a look at g_form.setLabel()



This could be used from within an onLoad client script to set the field label if your table is "B". Also see g_form.getTableName().



It might look something like this:



function onLoad() {


 


  if (g_form.getTableName() == "table_b")


        g_form.setLabelOf('field_name', 'Using');


 


}


It Worked.



Thanks a lot ctomasi.



But can you edit your answer. I think, by mistake, you have written function name as setLabel, its setLabelOf. If you can edit, it will help others to find correct function name in correct answer.