So I am using the following in the onValueEdit field of an entry form
var widgets = widget.root.descendants;
var to = 'xxxx#yyy.com';
var subject = 'Delivery Date Change For: ' + widgets.ProjectName.value;
var msg = "The Delivery Date for [ " + widgets.UsersPosition.value + " ] on [ " + widgets.ProjectName.value + " ] has been changed;
sendMessage(to, subject, msg);
So when a user changes a Delivery Date (by adjusting a Date Box) a notification email is sent out. I would like to add the actual in the Date Box but when I add " + widgets.DeliveryDate.value + " it says it is unrecognized.
Since the DeliveryDate is a Date Box, do I need something different? widgets.DeliveryDate.???
Thank you for any help.
"value" property is the one you need. Please note that it's JavaScript Date object so in some cases you need to convert it. But code you provided looks good to me.
What do you mean by "unrecognized"? Could you provide error details?
BTW: it's better to use Server Script to generate email message.
Related
I have a query that I am parsing using an automation runbook. When I extend a column that has a static URL reference, I get the error:
BadArgumentError- Query could not be parsed at 'https'
The extend looks like this:
| extend Body = strcat(#"<p>The following items are expiring <strong>within 30 days</strong></p>", "<p>Plan to remediate as soon as possible.</p>", "<p>If the item is no longer valid, please remove it from ", "Application Insights</p>", "<p>Property: ", Name, "</p>", "<p>Expires In: ", ExpiresIn, " day(s) " "</p>")
The runbook posts to a logic app via a webhook which sends a readable output to users.
We can use triple backtick (```) to qualify strings that contain single and/or double quotes.
P.S.
Also note the following:
Splicing string literals
Two or more string literals are automatically joined to form a new string literal in the query if they have nothing between them, or they're separated only by whitespace and comments.
print Name = "MyName", ExpiresIn = "7"
| extend Body =
strcat
(
"<p>The following items are expiring <strong>within 30 days</strong></p>"
"<p>Plan to remediate as soon as possible.</p>"
"<p>If the item is no longer valid, please remove it from "
```Application Insights</p>```
"<p>Property: "
, Name
, "</p>"
"<p>Expires In: "
,ExpiresIn
," day(s) "
"</p>"
)
Name
ExpiresIn
Body
MyName
7
The following items are expiring within 30 daysPlan to remediate as soon as possible.If the item is no longer valid, please remove it from Application InsightsProperty: MyNameExpires In: 7 day(s)
Fiddle
i got 2 nodes fetching some mqtt data, some temperature and humidity readings. Im trying to pass that info to a sqlite node. On that node i have the following code:
var newMsg = {
"topic": "INSERT INTO ambiente VALUES (null, #thisshouldbetemperature, #thisshouldbehumidity, date('now'), time('now') )"
}
return newMsg;
I try to use a join node but didnt make the work. So, what is the correct way to pass both msg.payload to that function? Thanks!
The join node is the correct way to combine the 2 incoming messages. You should use the manual mode and configure it to create a key value object something like this.
The problem is that your function node is ignoring the incoming data and creating a new message with just a topic set.
The fix for the function node is:
msg.topic = "INSERT INTO ambiente VALUES (null, " + msg.payload.temperature + ", " + msg.payload.humidity + " , date('now'), time('now') )";
return msg;
This will just update the msg.topic and leave the incoming msg.payload intact. This assumes that the MQTT messages arrive on topics temperature and humidity.
I'm developing a custom validator of a date input in my workflow form and I get a null after parsing a date this is what I done:
// check dates can be parsed
str_expiryDate = field.form.prop_wfbxTestWorkFlow_NfDate.value;
console.log("Non conformite"+str_expiryDate);
str_reminderDate = field.form.prop_bpm_workflowDueDate.value;
console.log("echeance"+str_reminderDate);
Alfresco.logger.warn("Expiry Date: " + str_expiryDate + " | Reminder Date: " + str_reminderDate);
d_expiryDate = Date.parse(str_expiryDate);
console.log("nfDate"+str_expiryDate);
d_reminderDate = Date.parse(str_reminderDate);
console.log("Date echéance"+d_reminderDate);
and then i get this in console:
Non conformite2013-06-21T00:00:00.000+01:00 echeance2013-06-09T00:00:00.000+01:00
nfDatenull
Date echéancenull
How I can parse these two dates and then compare it? .thanks
Use Alfresco.util.fromISO8601(date)
According to the client-api docs
Convert an ISO8601 date string into a JavaScript native Date object
You are parsing the "value" of a date, not the date itself.
The best way to compare is, imho, using the format YYYYMMDD, and than compare it as a number.
Something like this (there is sure a far more elegant way to do that, but at this time it's the only one that got me):
var indexDate=str_expiryDate.indexOf("-");
var dayDate=str_expiryDate.substring(0, 2);
var monthDate=str_expiryDate.substring(3, 5);
var yearDate=fromData.substring(6, str_expiryDate.length+1);
int dataNew=yearDate+monthDate+dayDate;
and than compare the two dates value.
Obviously check if the index value are correct, I didn't double checked them.
Hope il helps.
I know that there are simmilar questions like this on the forum, however I am still having problems to update a datetime field o the database. I dont get any problems when inserting but I get problems when updating and I am formating the same way , like this:
e.Values.Item("SelectionStartDate") = Format(startdate, "yyyy-MM-dd")
+ " " + startTime1 + ".000"
startTime is of type string.
I have tried different solution that I came across on the internet but still get this error.
Please help.
Thanks in advance
Try using DateTime.TryParse with appropriate format
if the insert work, I think the problem is on your calculation (the + " " + startTime1 + ".000")
try removing it (update the date to the same date) just for testing. If it works I suggest formatting the date on startdate and pass it. you can use #Johnny_D's method.
EDIT:
System.TimeSpan addDate = new System.TimeSpan(1, 0, 0, 0); //add one day
System.DateTime new_date = startdate.Add(addDate);
e.Values.Item("SelectionStartDate") = new_date;
I am working on a google Map Api using fusion. I have multiple search queries and want them to filter the results. At the moment they overrule each other and don't work together the filter the results. The site is called earthquakedamagemap.com. It is my university project. Any help would be much appreciated.
I think it is the 'value.replace' attribute which needs changing?
function changeMap2() {
var searchString = document.getElementById('search-string2').value.replace(/'/g, "\\'");
if(!searchString) {
layer.setQuery("SELECT 'Latitude' FROM " + tableid);
return;
}
layer.setQuery("SELECT 'Latitude' FROM " + tableid + " WHERE 'Updated Risk Assessment:' = '" + searchString + "'");
}
I posted some example code:
in this post not too long ago. You need to combine your search conditions with AND and call layer.setQuery with multiple search conditions only once. I don't think it has anything to do with your replace call as I didn't see any embedded single quotes in your input values.
Eric