Append Text at end of Calculated String Field

jasonprice
Tera Expert

I have a need to append text at the end of a calculated string field. Here is my current code (modified for forum). I simply need to add /view at the end of my value in the field. 

if(current.u_account_id !=''){

current.u_account_url=gs.getProperty('instance.url')+'/'+current.u_account_id;

current.update();
}

I figured it would be as easy as adding +'/view' the the value string but that doesn't work.

 

if(current.u_account_id !=''){

current.u_account_url=gs.getProperty('instance.url')+'/'+current.u_account_id+'/view'

current.update();
}

What am I missing here? Seems like this should be simpler than its proving to be. 

2 REPLIES 2

MrMuhammad
Giga Sage

Hi @jasonprice

I suspect, if you are trying to set the value of calculated field via business rule then that might be a hick up because calculated field doesn't store any value in the database and it calculate the value everytime the row is being read so technically when you try to access its value in BR which fetch the value from database , it might get emtpy value and doesn't work as expected.

However, can you give some details on what error or output you are getting? That will help me understand better!

Regards,

Muhammad

Regards,
Muhammad

Hello, 

The script does in fact display the URL just without the /view at the end of it. No other errors or messages are being displayed. The URL requirements have changed recently to require the /view to work correctly, so this was an existing BR that I was trying to adapt to work for the new requirements.