How to add an external link in list page on Quotes module in SuiteCRM 7.2.2

Hi,

I want to add an external link “View Quote” (which takes user to another website) at the end of each row on list page of Quotes Module.

Is this possible in SuiteCRM 7.2.2. If yes, what is the process to achieve this.

Thanks in advance.

You can add a URL field in Studio and add it to the create, edit and list view. So when you create a Quote you can enter what the URL should be and it will display the link on the list view.

If the URL is always the same you could put it in an HTML field (again add this in studio, but this time you only need to add it to the list view).

Or if you need the link to be set automatically, but it’s not always the same (i.e depending on id or some other variable) you’ll still need to add a custom field for it, but you will also have to add a logic hook to set the URL when the quote is saved.

1 Like

Hi, Thanks for your reply.

Can you please explain in detail how to do this as I am a beginner in SuiteCRM.

I want to add a link created using a dynamic variable for each quote.

I want a link displaying as “View Quote” and having http://www.abcxyz.com?id=5 in its href part of a tag.

Thanks.

If you go to the admin section of suite and click the studio then click the quotes icon, then click fields there is a button at the top to add a field. Once you’ve added the field you then need to click on the layouts option in studio and add the new field to the list view.

This gives us somewhere to store the URL and will display it in the list view.

To actually set the URL for each quote you are going to need to write some custom code. place a PHP file in /custom/Extension/modules/AOS_Quotes/LogicHooks

with something like:


$hook_array['before_save'] = array();
$hook_array['before_save'][] = Array(10, 'setLink', 'custom/modules/AOS_Quotes /updateLink.php','updateLink','update');

This hook will be called everytime a quote is saved. We only have one hook we want but if there were multiple hooks the number at the start tells Suite what order to run them in, the next value is an arbitrary name, then the next values tells Suite the path to the code, the class name and the method to call.

You then need to write code which sets the id. The hook method gets the bean that is being saved passed to it. Then I’m not sure if there is an external id or if it’s suites id you want to use, but lets say it’s suites id for the quote the code would look something like:



if (!defined('sugarEntry') || !sugarEntry)
    die('Not A Valid Entry Point');

class updateLink {

function update($bean, $event, $arguments) {
	$bean->our_custom_field_name_c = "www.abcdef.com?id=" . $bean->id;
}

If you’re not confident writing code you could follow the steps I described above to add a field (and choose URL), then also add it to the edit view and when you create a new quote you can manually type in the URL.

Alternatively if you would like a quote for the work to be carried out for you please use this form:

https://suitecrm.com/contact?id=129

Hope that helps