I have Guidewire's TextCell
with formatType="email"
attribute in a .pcf file. Looking in browser, appropriate HTML control has the attribute href="mailto:info@clientcompany.org"
and it works fine, opening new email message window with the TO field populated.
Now I want my program to add subject to that message, to have something like "mailto:info@clientcompany.org?subject=claim number 1122"
in the generated html.
As far as I can see, there is no such a possibility in Guidewire's TextCell component. Is there a way to achieve this inside the context of Guidewire's framework ?
I don't think this is possible out of the box without writing some custom HTML or JavaScript in Guidewire. Since you are trying to do this in a cell, which is basically a text column in a list view, it just makes the job harder. Below are some alternatives to achieving your goal.
1. TemplatePanel
Guidewire supports TemplatePanel
which allows you to write custom HTML and JS and embed it on any existing PCF. You can simply drag the TemplatePanel widget on your PCF and write your HTML code in the Template Panel Contents tab. In case you were doing this for an input or button, your requirement could be achieved by using something like the below:
<html>
<a href="mailto:info@clientcompany.org?subject=${aSubject}">${anEmail}</a>
</html>
Note that aSubject
and anEmail
are PCF Gosu variables that can be injected in the TemplatePanel's HMTL code as per your need. You can even add your CSS to style the link in a way that it appears to be a part of the Guidewire theme using the same font, size, etc.
2. Custom JavaScript
Another way to achieve this is by writing custom javascript which sets the href
property of your cell dynamically. This can be achieved either by adding a new system and JS function in your customer.js
file and then calling it from an elements action property by using javascript:gw.globals.yourSystem.yourFunction()
.
You can also use JavaScript to open a new tab with the URL as above.
window.open(url, '_blank');
where url=mailto:info@clientcompany.org?subject=Your Subject
3. Exit Points
Instead of going through the pain of doing the above, you could leverage an ExitPoint
and simply redirect the user to the URL mailto:info@clientcompany.org?subject=Your Subject
where the email and subject can be inputs to the ExitPoint
and it will effectively achieve the same result of opening user's email application with the subject line.