Related Field not updating on Save

Posted by IramK on 07-Jul-2015 09:21

Hello,

I have two objects A (product) and B (group) and I have object B's lookup field in the new page of A. I also have a related field from object B (currency) in object A. When I select a record from object B using the lookup selector on the new record page of object A, I would expect that the related field would update automatically when I save the record A. However this does not happen and I get an old value of the related field. If I go back and edit the record A again and save it without making any changes, the changes are reflected on the related field. Could anyone please point out to me as to why this is happening? It is as though the related field is not taking in the changes once the record A is saved and if we go back and edit the form and save again it is taking the changes. Is there some sort of cache issue here? Kindly let me know.

Posted by Godfrey Sorita on 09-Jul-2015 13:12

Yes, I faced the same issue when using record name as the related field. To further explain the workaround, I made an example which can be performed on your end.

1. Create a Text field "Group Name" in Object B.
2. Set the Record Name Template of Object B using the field token of Group Name. Make sure to tick "Update names of all existing object records using this template" property.
3. Set the Related Field in Object A to reference Group Name.

Let me know how it goes.

All Replies

Posted by Godfrey Sorita on 07-Jul-2015 10:14

I can't reproduce the issue on my end. Do you have a script which updates the value of the field referenced by the related field? Can you attach screenshots of the steps you made?

Posted by IramK on 07-Jul-2015 11:01

[mention:9c7be15f444c42e4809af5b84a23adff:e9ed411860ed4f2ba0265705b8793d05] , There is no script that updates the value of the related field. Its the standard related field that Rollbase provides. The related field is just a field(called currency) in object B(group). I am basically creating a new record A and attaching a record B using its lookup field selector. On saving I'm expecting the related field currency to be populated from the attached record B.

Posted by Godfrey Sorita on 07-Jul-2015 11:27

What type of field was used for the related field? I used a currency field type as the related field and it gets updated after saving the record.

Posted by IramK on 08-Jul-2015 03:39

[mention:9c7be15f444c42e4809af5b84a23adff:e9ed411860ed4f2ba0265705b8793d05] Just to confuse things a bit more, there is basically a third object C that is attached to object B and not A. In object B, there is a related field from Object C and the field is the record name itself in object C. And now when we come to object A, this related field in A is related to that related field in B. Hope its not confusing.

Just a summary of what I meant above.

Object B: related field ('relatedFieldC') from object C (record name)

Object A: related field ('relatedFieldB') from object B (relatedFieldC)

Kindly let me know if you are able to reproduce this issue.

Cheers.

Posted by Godfrey Sorita on 09-Jul-2015 12:37

The record name template overrides the value after saving the record. A workaround for this issue is to assign a field as name template of the object. Then instead of referencing the record name in the related field, use the field mapped in the name template to prevent it from being overridden.

Although the workaround works even on the third layer, I'm curious how you enabled Edit Mode of related field in object A. The property "Display this field in Edit mode on Edit pages" is disabled when I use a related field on a related field.

Posted by IramK on 09-Jul-2015 12:46

[mention:9c7be15f444c42e4809af5b84a23adff:e9ed411860ed4f2ba0265705b8793d05] : The related field is not available in edit mode on object A. What I meant by going into the edit page was, the change would only occur if I go into the edit page of record A (related field is not editable) and save the record without making any changes, only then the related field value gets updated.

So if I'm not wrong, is the issue that I'm facing likely being faced by you as well if I'm using a record name as my related field? I will try your technique of using a template field with the record name.

Posted by Godfrey Sorita on 09-Jul-2015 13:12

Yes, I faced the same issue when using record name as the related field. To further explain the workaround, I made an example which can be performed on your end.

1. Create a Text field "Group Name" in Object B.
2. Set the Record Name Template of Object B using the field token of Group Name. Make sure to tick "Update names of all existing object records using this template" property.
3. Set the Related Field in Object A to reference Group Name.

Let me know how it goes.

Posted by IramK on 13-Jul-2015 05:26

[mention:9c7be15f444c42e4809af5b84a23adff:e9ed411860ed4f2ba0265705b8793d05] I understood your approach and found a better way of doing this i.e. via a "Template Text" field that takes in a token as well and just sets the value based on the record name. I then used the related field to link to this field rather the record name itself. This way it worked every time. Thanks for the suggestion.

This thread is closed