truncating a field's length in BR

vishuanand
Kilo Contributor

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?

6 REPLIES 6

Alikutty A
Tera Sage

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


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.


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


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.