Scripts allow you create rules, to execute specific actions using a cause-effect pattern. To put it simply: If this then that.
In this article, we introduce you the 3 main uses of scripts with Touch & Sell Performance.
- App Navigation via a script.
- Folder/content opening from a notification.
- Folder/content opening from a HTML document.
Requirements:
This article comes with script examples you can use depending on your use case. You will only need to customize them with your folders/contents ID. The ID is the last number in the folder/content URL.
To copy/paste these ID directly from the URL:
- Folder ID: From your Studio > App > Content, open the folder and copy the last number in the URL: this is the folder ID.
- Content ID, right click on the edit button and select "open in a new windows". Copy the last number in the URL: this is the content ID.
App Navigation via a script
This first use case allows you to navigate through the app contents.
I.e: By clicking on a folder A, you will be redirected to a specific content on a folder B.
To create this type of script, go to your Studio > App > Contents > Click on the button "Add Content..." and choose "New Script".
In the pop up, add the following code:
TouchSell.getNodeById(FOLDER/CONTENT_ID).then(node => node.open())
Folder/content opening from a notification
Notifications are used by administrators to communicate with users, from the Studio to the app. These notifications are often used to introduce a content added to the app. Having a chance to access this specific content by just clicking a link in the notif will help your users to find it.
You will find more details in the article Insert a link to a file/folder from a notification
Here is the script to add and customize:
<p>
<a
href="#"
onclick="TouchSell.getNodeById(FOLDER/CONTENT_ID).then(node => node.open())"
>
Click here
</a>
</p>
Folder/content opening from an HTML document
HTML files often include several links. That's why we suggest you to use a 2-parts script:
A first part to introduce the use of the script and how it works.
<script type="text/javascript">
function openNodeById(nodeId) {
TouchSell.getNodeById(nodeId).then(node => node.open());
}
</script>
And a second part, that you will have to add and customize for each link:
<p>
<a
href="javascript:openNodeById(FOLDER/CONTENT_ID)"
>
Open this document
</a>
</p>
To go further, consult our technical literature
Commentaires
0 commentaire
Vous devez vous connecter pour laisser un commentaire.