Timeline for How to set field on record returned from server?
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
S Aug 27, 2016 at 1:07 | history | suggested | bafuda | CC BY-SA 3.0 |
Solution was to make a copy of the object not to set a default
|
Aug 26, 2016 at 22:14 | review | Suggested edits | |||
S Aug 27, 2016 at 1:07 | |||||
Jul 27, 2016 at 18:15 | comment | added | Ashwani | I know. But has to explain. It can be a one liner as well if approach modified slightly. @Praveen | |
Jul 27, 2016 at 18:13 | comment | added | Praveen |
@Ashwani This can be a two liner : var acc = response.getReturnValue();acc.Rating = 'Hot';cmp.set('v.acc', JSON.parse(JSON.stringify(acc)));
|
|
Jul 27, 2016 at 18:01 | vote | accept | bafuda | ||
Jul 27, 2016 at 17:55 | comment | added | Ashwani | @bafuda got a workaround for you. Updated the answer. | |
Jul 27, 2016 at 17:55 | history | edited | Ashwani | CC BY-SA 3.0 |
added 530 characters in body
|
Jul 27, 2016 at 17:36 | comment | added | bafuda | @Praveen I thought that the actual use case would distract from the question. The actual use case is to set the 'sobjectType' property on records returned from the server, add them to an Object[] attribute, iterate over the Object[] attribute, and do conditional rendering based on the value of the 'sobjectType' property | |
Jul 27, 2016 at 17:26 | comment | added | Praveen | @bafuda do you want to set Rating to Hot only if its null? | |
Jul 27, 2016 at 17:12 | comment | added | bafuda | This doesn't work. Once the default value is overriden with the object retrieved from the server the Rating field still cannot be set. | |
Jul 27, 2016 at 16:58 | history | answered | Ashwani | CC BY-SA 3.0 |