Sharing a bookmark by e-mail in SAP Lumira 2.x
Since Lumira 2.x this Bookmark sharing functionality has been deprecated. The e-mail functionality now allows you to create e-mails with any content that you want. You can now create e-mails with content other than just Bookmark URLs. The API call is:
APPLICATION.sendEmail(StringArray receivers, String subject, String content);
You can pre-populate some of the e-mail data prior to sending it off to the local e-mail client.
Firstly remember that you can only share Bookmarks with a Global access type. Bookmarks with a Personal access type can only be viewed by the users that created them. You can simply get the URL of the relevant Bookmark and pass it to the new API. For example, you have listed all of your Bookmarks in a ListBox. The code snippet below shows how you might share a specific Bookmark in the ListBox after selecting it:
var bookmarkId = LISTBOX_1.getSelectedValue();
var url = BOOKMARK_1.getUrl(bookmarkId);
APPLICATION.sendEmail([“help@sap.com”], “Sharing a bookmark via email”, url);
You can use the onClick event of a button, or some other element to trigger the above script. Once you call the script you will get your new e-mail created in your local e-mail client:
So now you can send e-mails to your colleagues containing a direct link to a given Global Bookmark.
If you wanted a popup prompt like the 1.6 behavior, you can construct one quite quickly using a Dialog component:
In the example above, you have a Dialog containing an Icon, an InputField and a Button. Then do the following:
- Add the following onClick to the Icon:
-
APPLICATION.openNewWindow(INPUTFIELD_1.getValue());
-
- Set the InputField property ‘editable’ to false
- Add the following onClick to the ‘Send by e-mail’ button:
APPLICATION.sendEmail(["help@sap.com"], "Sharing a bookmark via email", INPUTFIELD_1.getValue());
Now you have a Dialog prompt to share Bookmarks by e-mail. However, the flexibility of the API in 2.x will allow application designers to use the e-mail functionality across the application and not just for Bookmarks.
Hi Robert,
thanks for your helpful feed.
We have some problems sending bookmarks in Lumira. We get the Bookmark ID like in your example, the email content looks fine containing the application and bookmark ID, but when trying to open the link the application throws an error:
"Cannot reset status of application."
Do you have any idea what might be wrong?
Thanks,
Oezlem
Hi Özlem,
Generally this message is only an INFO level message and doesn't necessarily mean that the bookmark was not loaded correctly.
If you are just getting INFO level messages in the application that say this then it can probably be ignored. The application log level severity could be changed also if your users are concerned about it.
In you instance does the bookmark load correctly or does the application get an error and not open at all?
If it's the latter then you would be better off opening an incident as it would probably take some time to debug it and see why it is not loading correctly.
Kind Regards,
Robert
Hi Robert,
Very useful blog and helpful information.
I have a similar kind of requirement in which we already have Design Studio 1.6 Dashboard and old bookmarks API written in Event Onclick for Share Workbook Button. Now i am able to achieve the email function to share bookmarks writing below command in on click event for Share Workbook button.
APPLICATION.sendEmail(StringArray receivers, String subject, String content);
Can you throw some light on how to get the pop-up window also in the same onclick event of already existing button Share Bookmark.
I did try the Dailog Component option that is mentioned in the blog but how to add this to the already existing Button Share Bookmark is the open question.
Thanks,
Rakesh
Hi Rakesh,
It completely depends on what the script contents of your "Share Workbook" button are. To me it sounds like you already had something like:
The deprecated Bookmark.shareBookmark call already opened a Popup with a link and a button that created an email. This post is simply a way to recreate that using the modern APIs with the new Bookmark Technical component.
I would not suggest mixing the approaches as they use different APIs and you could end up with multiple open dialogs.
Thanks,
Robert