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 04:50 AM
I guess, if the field length is 100, it should be automatically truncated Or else you can try this
parsedObject.Description = recordObject.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:31 AM
Thank you Alikutty for your response. But i tried this already and its not truncating the short description field to 100 characters. We cannot change the field length to 100. Hence, required to truncate it before sending to other system.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2017 05:42 AM
Can you show your complete code or business rule? The above code sets value to Description and not short description. Try this
parsedObject.short_description = recordObject.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:50 AM
Hi Alikutty,
i may not be able to share you the whole BR but yes it is setting value to short description only and for description we are setting it in detailed description.
I would appreciate if you suggest any other way to do it.
Thank You.