AnsweredAssumed Answered

How to retrieve the generated URL value for a URL field type using the "generate" option?

Question asked by Chad Hutchins on May 17, 2017
Latest reply on May 17, 2017 by Chad Hutchins

The Sugar URL field type has a nice feature where it will generate a URL for you based on other fields on the record. For example, if you want to link to another system and pass the contact's Sugar record ID, you could have a custom field use the template "https://theothersystem.com/?id={id}" and when you view the record in Sugar, the link field will automatically generate the {id} part so that when you click the link it is properly filled in.

 

I'm wanting to retrieve this generated link value and use it in my custom code, the only issue is that when you pull the bean, the field does not give you the generated value. It will give you the template.

 

<?php 
// This doesn't work
// say I have a field, generated_url_c and it should be https://website.com/{id}
$record = BeanFactory::getBean('Contacts','1234-1234-1234-1234');
echo $record->generated_url_c;
// this will return https://website.com/{id}
// not https://website.com/1234-1234-1234-1234

How do I get the generated URL value on the server side? Is there a method we can run these URL fields through to get the generated value?

 

Thanks!

Outcomes