How to translate a text in business rule- service now - translation

Heh guys,I am new to service now. I am doing translation in my portal for english and french.
For custom text I have done like this
Server script:
data.welcomeMsg= gs.getMessage('Welcome to the portal');
Html:
<p>{{data.welcomeMag}}</p>
It works good. when english is selected message will be displayed in english language,when french is selected message will be displayed in french(I have used messages table for translation).
Now,I am getting the following sentence from business rule not in widget level.
res.comments =' Request is pending approval from- ' + current.approver.name;
I want to translate this text Request is pending approval from here.So I tried this,
res.comments =gs.getMessage(' Request is pending approval from- ') + current.approver.name;
But text is not getting translated in portal.
Anything wrong with my code? Guys please correct me if I am wrong.
Thanks!!

When using gs.getMessage(...), it pulls translations from UI Messages but in my testing it doesn't match translations with leading or trailing white-space.
Try tweaking your messages a bit to see if removing those resolves it if that is what your translation has.
Change your UI Message Key from this
Request is pending approval from-
To this
Request is pending approval from-
Once I made that change, both of these worked
gs.getMessage(' Request is pending approval from- ')
gs.getMessage('Request is pending approval from-')

Related

What causes a "NO UID SEARCH State error"

I have a script that connects via TCP/Sockets, Authenticates SSL, and then checks if the response from stream returns "OK".
It then sends a UID search command:
{tag} UID SEARCH (UNDELETED) (SENTSINCE "{RFC2060 Format Date}")
I then follow that with another OK check aswell as a * SEARCH stream response check.
When both of those are not true, I always end up with this as a result from the stream: xm005 NO UID SEARCH State error
Im not certain but is it possible this returns if the email has no UNDELETED inbox or something?
This seems to occur all the time on one of my chinese friends specific accounts on yeah.net (163-China related email service).
When I login to it with Windows 10's Mail App, I can see it has inboxes in CHINESE. Is it possible something to do with that is causing this issue?
I'm essentially wanting to search for every email within the sent-since date that has not been deleted, perhaps (UNDELETED) isn't a global declaration and is an actual inbox or something?
According to IMAPv4.1's RFC:
UNDELETED
Messages that do not have the \Deleted flag set.
So maybe its not to do with Inbox's? regardless its pretty odd that both emails this occurs on have Chinese Inbox's yet my English-Only one works splendid.
I removed (UNDELETED) and attempted running, and the same issue occurs, so it's not that.
The "state" in the error message could mean "your state does not include a mailbox". Make sure to issue a SELECT command before UID SEARCH.

How can I make a Gerrit reminder bot?

As I have code reviews open in 5-6 gerrit instances it can happen too often to forget to notify people to perform reviews on them and as anyone knows, a CR that gets old also gets obsolete and the effort invested in it is mostly lost.
I am planning to write a gerrit-reminder-bot which queries all gerrit servers for reviews opened by you, checks the age and the status (no votes and no negative votes) and sends an email to each reviewer.
Now the question is if we already have something similar that can be improved or used as a starting point.
Please note that using gerrit event stream is useless in this case because we do want to send reminder notification for stalled reviews, and obviously that a stalled review does not get any notifications.
We went with an "in-house" solution -
a script that runs a Gerrit-query and parses the (JSON) results.
Basic flow
Define: How old is "old" (in terms of "last modified" time),
before you start nagging people
Get a list of all open Gerrit-changes - in our case - as a JSON:
ssh -p $gerritPort $gerritHost gerrit query --format=JSON --current-patch-set limit:$queryLimit status:open
note -
Each line of the result is a "mini-JSON" that should be parsed on its own
The summary-line has a different format - can ignore it completely
For each line
Parse the JSON to get the key/value pairs
If not "old enough" - skip it
if (Verify < +1) --> "Forgot to Fix the Build"
else-if (CodeReview < +2) --> "Forgot to Get a Good Review"
else-if (CodeReview == +2 and Verify == +1) --> "Forgot to Submit"
For each scenario we send a slightly different mail that describes the case,
with a link to the relevant Gerrit-change.
The mail is sent both to the owner and to the reviewers (in CC),
to cover cases where the owner is on vacation (or left).

JIRA - JQL with Webook - Only trigger webhook if change was not caused by certain user

We're using Slack and JIRA together and we want to create one webhook for every of our users. If any user A makes a change in user B's issues, user A should be notified via Slack. But if user A makes a change in user A's issues, user A should NOT get a notification in slack.
We tried the following JQL statement for the user "max":
project = "Project Name" AND assignee="max" AND NOT status changed AFTER "-2m" by "max"
Unfortunately it does not work.
If Max makes a change to his issues, he gets a notification in Slack, but if he changes the same issue again afterwards, he does not. It seems like the "status change by" is not set at the time the webhook is triggered, but only afterwards.
Is there some kind of field for the User who triggered the webhook? That is essentially what we need.
EDIT:
More info: We're using this Slack integration and combining it with the webhook:
https://marketplace.atlassian.com/plugins/eu.wisoft.slack.jira/cloud/overview
I created an additional "all Jira notifications"-configuration with this Slack-plugin and it works quite fine. Hence, the slack plugin does work fine, but my JQL filtering is the issue apparently.
Last try:
project = "Project Name"
AND assignee="max"
AND status changed AFTER -2m
AND NOT status changed by "max" AFTER -2m
Using this from a comment, I was able to get it to work inconsistently:
A new jira-issue that I put on Todo with "max" and assignee "max", that is moved by another user to "Progress" (hence status-change), does not cause the webhook to trigger. The next time, the same user changes this issue from progress to todo or back, the webhook is triggered. It feels like at the time of the webhook call, the latest information is not available. It feels like at the time of the first change, this part fails:
AND status changed AFTER -2m
How could I fix this?
I think the JQL you're looking for is this:
project = "Project Name"
AND assignee="max"
AND status changed AFTER -2m
AND NOT status changed BY "max" AFTER -2m
This is telling JIRA:
Give me everything in project-name;
That is owned by max;
Limit it to anything where the last status change was after 2 minutes ago
Further limit it so that the last status change was NOT done by max in the last 2 minutes

Asana * Wufoo : Advanced integration

I am working on "Advanced integration" of a forms from Wufoo to Asana. SO far I have followed the Asana guide - https://asana.com/guide/help/api/wufoo
Guide is excellent and everything within the guide work as it says, but I need to go a bit further.
I notice that there is a bit of symbols that asana recognize from the forms( like quotes"" , equal ==, question mark ?), example of multiple choice menu:
"Chose person" == "asana tag" ? 1559453678421
"Chose person" == "asana person" ? blablabla#something.org
So in the following example I can have a multi choice menu that can assign task to a person and/or put a tag.
If I add a second person, that person become a follower, which is great.
My goal:
I want to make the form filler to add its email address, and that email address to be add as follower of the task.
What I know:
I have so far talked with Wufoo support and they told me that the text from the form goes in a straight text form to Asana, and asana actually recognize the form and create the specific tasks, for example:
<strong>This become BOLD text in asana</strong>
I keep on looking for the rest of the recognized symbols, but without success so far. If you have any kind of information regarding the "Advanced integration" I would love to know.
(I work at Asana.) Right now we only support routing through fields that are hidden (have the "hide" classname) with our Wufoo integration, but your use-case is very interesting. I'll take a look and see if we can enable this.
I have found a 2 workarounds to make this work for me.
Workaround 1
So far I have discover that asana recognize "hide" CSS Layout and the field labels : project,tag,assignee,follower . If these values are true then to make this editable I add a Wufoo form Rule that can show/hide fields. for example :
If "Email" contains "#" show "assignee"
And that rule does not change the CSS Layout Keyword "hide" so the form is send the same way with the only difference that the "hide" field is actually visible and that make it easily editable.
Workaround 2
By keeping the fields hide you can still edit them with "URL Modifications ". So basically have 2 forms linked together, so the first form fill up information that is send to the second form within the URL, so the fields remain hidden but being filled up by the URL. - I have not played with that much but Wufoo support briefly explain to me that its possible
URL Modification reference - http://help.wufoo.com/articles/en_US/SurveyMonkeyArticleType/URL-Modifications

can I force Outlook 2007 rule to print first page only?

I have set up a rule to quite simply print out an email when received from a certain address (Amazon sales) - The idea being that as orders come in, they are auto printed and waiting to be packed.
However the amazon emails require 2 pages.
under the Rules menu in Outlook, the option is simply "Print" but no further print preferences are available.
Is there a way to get it to print the first page only? a script possibly?
No, Outlook Object Model does not porvide any fine controls over the print functionality. As a workaround, you can export the message as a DOC file (MailItem.saveAs), then programmatically load it in Word and use the Word Obejct Model to print it.

Resources