How do I add a Web URL to a document using LotusScript - hyperlink

I have an agent that takes a copy of a template document and puts in values from a text file.
I am running into a problem when adding a hyperlink to a field programmatically, If I just add the text (e.g. http://www.google.com) there is no hyperlink just plain text. If I add the text manually, by editing the document just adding the address works fine and is clickable.
I have tried creating a rich text object then adding that to the field but that doesn't work either :(
Set rtItem = New NotesRichTextItem( doc, "link" )
Call rtitem.AddNewLine( 1 )
Call rtItem.AppendText ("http://www.google.com")
doc.AppendItemValue "Details", rtItem
To be clear, I'm looking for a way to append a clickable hyperlink to a field using lotusscript. Any help would be greatly appreciated.
EDIT:
Upon further inspection if I generate a document with a link in the text field and save it (programmatically using doc.save) it saves as plain text, as soon as I then go into this document and do a manual save the plain text turns into a link just fine. Could something be wrong with how I am saving?
If (Not doc.save(True,False,True)) Then
Msgbox("Document could not save")
End If

It does work the way you tried in your code with just "AppendText". But, the link works only if the document is in read mode and client property "Make Internet URL ... into Hotspots" is set.
UPDATE:
AppendItemValue doesn't work for RichTextItems.
Append the link direct to your field "Details" or if it doesn't exist then create it. Your code should look like this:
Dim rtItem As NotesRichTextItem
If doc.Hasitem("Details") Then
Set rtitem = doc.Getfirstitem("Details")
Else
Set rtitem = doc.Createrichtextitem("Details")
End if
Call rtitem.AddNewLine( 1 )
Call rtItem.AppendText ("http://www.google.com")

Related

How to create dynamic hyperlink using Field Codes in MS-Word?

I am trying to add a hyperlink to a field code in MS-Word, but I want the same field code to populate as part of a search query in the url. More relevant info below:
For Instance, this field code is linked to a form and will populate with a tracking number pulled from an inventory database «TrackingNumber», but then I want to link this generated tracking number into a url query is as follows:
HYPERLINK "https://www.google.com/searchq=«TrackingNumber»"
Is this even possible? And if so, how should I configure?
By default, if you insert a mailmerge field into a hyperlink field, the hyperlinks will all show the first record’s address as the 'Text to display' text, even though the hyperlinks will actually point to the merged targets.
Here's how you can do get a mailmerge to display your preferred default 'Text to display' text instead:
Disregarding mergefield issues for the moment, insert a hyperlink into the document in the normal way, choosing whatever 'Click Here' text you want in the 'Text to display' box.
Select the inserted hyperlink and press Shift-F9 to expose its field code.
Replace everything in the field between '=' and '"' with your «TrackingNumber» mergefield.
Select the field and press F9 to update the display.
In Word 2007 & later, you can make the display text variable also, by following these additional steps:
Position the cursor anywhere within the display text.
Insert a mergefield pointing to whatever data field you want to use for the display text (this could even be the «TrackingNumber» mergefield).
Delete all of the previous display text either side of your last-inserted mergefield (note that this field will likely have updated already).
Execute the merge.
After merging to a new document, use Ctrl-A, F9 to update all fields. Without this, the mergefield hover text won’t update to the correct targets.
Note 1: The above is only for merged output sent to a new document; it does not work with merges to email or print. For merges to email, see: https://support.microsoft.com/en-us/kb/912679
Note 2: Hyperlink fields modified this way are liable to cease functioning once the merge has been executed. Accordingly, it's best to save mailmerge main document before doing the merge and not re-save it afterwards. If you need to make changes to the mailmerge main document, don't make/save them after doing a merge; make/save them beforehand.

Active Record/Ruby on Rails -> Delete image by click on link: Set attachment columns to NULL via

I am not sure how to do this. I have a table called "animals".
Then i can add an image to display the animal.
I use this statement in the form-view for changing the image:
f.file_field :attachment, :accept => 'image/jpeg'
When i submit the form i got a nice looking image in my show-view.
Like i said, i can easily change the image, but i do not know exactly how to delete it. In a perfect world i would prefer, i press a link and the image gets just deleted, but the rest of the animals attributes stay alife, so the following columns are set to NULL and the file gets deleted from the server:
"attachment_file_name"
"attachment_content_type"
"attachment_file_size"
"attachment_update_at" (should probably be set to the current date, or set to NULL)
Any help apreciated.
If you are using paperclip gem all you need to do is set attachment to nil and save. Like this:
#animal.attachment = nil
#animal.save
More info here
In your case, if you want to add a link to remove, you will create a route and an action just to do this.
I suggest adding a checkbox nearby the file field and verify it at update/create.

Time format for PDF template in Orbeon 4.10

Im using orbeon 4.10 to collect data and fill back a PDF from a template. I would like to choose how the time is displayed on the pdf. I have seen the oxf.xforms.format.input.time and oxf.xforms.format.output.time properties, but they seem to only control the form itself.
I have also seen this, but it seems to relate to the date format.
What value do I need to change in my properties?
Thanks
UPDATE: I don't think my solution below actually works. I think this might have worked at some point but might not work anymore. We do have an RFE for this.
You can use the following property:
<property
as="xs:string"
name="oxf.fr.resource.$app.$form.$lang.print.formats.time"
value="[H01]:[m01]:[s01]]"/>
where:
$app is the app name
$form is the form name
$lang is the language which applies
You can use wildcards (*) for all of those.
As a workaround i used a Hidden field to format my time correctly for the pdf.
Here is the formating code :format-time($controlname, '[H01]:[m01]') that i used in the calculated value
Here is the visibility code : $fr-mode = 'email' for the pdf generated from email or $fr-mode = 'pdf' for pdf button.

Extraction from string - Ruby

I have a string. That string is a html code and it serves as a teaser for the blog posts I am creating. The whole html code (teaser) is stored in a field in the database.
My goal: I'd like to make that when a user (facebook like social button) likes certain blog post, right data is displayed on his news feeds. In order to do that I need to extract from the teaser in the first occurrence of an image an image path inside src="i-m-a-g-e--p-a-t-h". I succeeded when a user puts only one image in teaser, but if he accidentally puts two images or more the whole thing craches.
Furthermore, for description field I need to extract text inside the first occurrence inside <p> tag. The problem is also that a user can put an image inside the first tag.
I would very much appreciate if an expert could help me resolve this what's been bugging me for days.
Text string with a regular expression for extracting src can be found here: http://rubular.com/r/gajzivoBSf
Thanks!
Don't try to parse HTML by yourself. Let the professionals do it.
require 'nokogiri'
frag = Nokogiri::HTML.fragment( your_html_string )
first_img_src = frag.at_css('img')['src']
first_p_text = frag.at_css('p').text

Salesforce Create Buttons and Links option - Custom URL to launch email template

I have an email template that I would like to launch from within the case using a Link/Button. I see the option under setup->customize->cases->button and links I even see where I need to place the URL. What I don't see is nay documentation on how to build the URL to launch an email template. Any help you be great
I don't know if this is documented anywhere by salesforce, but I found from some guess work:
/_ui/core/email/author/EmailAuthor?p3_lkid={!Case.Id}&p2_lkid={!Case.ContactId}&template_id=00X40000000weWn
Just use that as the url content of a custom button or link. This one is for cases, as you are trying to do, but I think this should work for other types of objects as well.
The parameters are p3_lkid, which is the case id, p2_lkid which is the id of the contact you are emailing, and template_id which is hardcoded to the desired email template. (You can find this id by looking in the url of the Setup page for the template)
This was really helpful. I did, however, figure out another way to do it. Click on the "Send an Email" button you currently have. Copy the URL and add &template_id=YOUR TEMPLATE ID.
There is one other ID number that will show up in the original URL. Change that to be the dynamic field you want it to be.
For example:
Copy url from "Send Email": https://na3.salesforce.com/_ui/core/email/author/EmailAuthor?p3_lkid=70150000000Axj1&retURL=%2F70150000000Axj1
Add &template_id=YOUR TEMPLATE ID so it looks like this:
/_ui/core/email/author/EmailAuthor?p3_lkid=70150000000Axj1&retURL=%2F70150000000Axj1&template_id=YOUR TEMPLATE ID
Remove the other id (it's the object you used to send the email - so in this case, I was wanting to be able to send an email directly from a Campaign) and replace with the dynamic field:
/_ui/core/email/author/EmailAuthor?p3_lkid={!Campaign.Id}&retURL=%2F70150000000Axih&template_id=YOUR TEMPLATE ID
And voila! It should work!
Abeyer's answer is good. However, if the template contains solution attachments "{!Case.Solution_Attachments}" the attachments will not get included unless you add the new_template=1 parameter to the URL making it:
/_ui/core/email/author/EmailAuthor?p3_lkid={!Case.Id}&p2_lkid={!Case.ContactId}&template_id=00X40000000weWn&new_template=1

Resources