truncating a field's length in BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2017 04:49 AM
Hi,
I am writing a BR where i want to truncate a field's length(lets say to 100 characters). For eg:
parsedObject.Description = recordObject.short_description;
Here, i want to truncate the length of short_description to 100. could anyone help me how to do this?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2017 05:57 AM
It is confusing as I cannot understand what is parsedObject or recordObject, Can you explain what you are trying to achieve (use case) and if this is a before BR? I would do be adding this line in my BR if I want to truncate the short description to 100 whenever it is updated.
current.short_description = current.short_description.toString().substring(1,100);
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2017 05:57 AM
Hi Vishwajeeth,
Can you try the below code this very helpful for you.
parsedObject.Description = recordObject.short_description..substr(0,99);
thanks
pavan dodla
Please Hit like, Helpful or Correct depending on the impact of the response