I would like to seek help on ticking checkboxes upon issue creation via rest API.
I have three checkboxes:
CheckBox1
CheckBox2
CheckBox3
Each checkbox have same name ,customfield_10000 , but different id.
CheckBox1 - id : customfield_10000-1 | value : 10700
CheckBox2 - id : customfield_10000-2 | value : 10701
CheckBox3 - id : customfield_10000-3 | value : 10702
Lets say I want to tick Checkbox 1 upon creation of issue via rest api.
My current code:
{ "customfield_10000 " : [
{
"value" : "10700",
"id" : " customfield_10000-1"
}
]
}
Result:
'error': {'customfield_10000 ': "Option value '10700' is not valid"}
I tried to put "Y" on value but I also got an Error:
'Error', 'error': {'customfield_10000 ': "Option value 'Y' is not valid"}
Thank you!
From my understanding, when updating a checkbox custom field, don't think of each individual checkbox as their own field. As such, when setting the value of the field, you can't interact with each individually, instead you have tell the field which boxes should be ticked and which should not each time you update it.
To do this you just need to provide the names of the ticked checkboxes
{ "customfield_10000" :
[
{ "value" : "CheckBox1"}
]
}
The above will tick just CheckBox1
{ "customfield_10000" :
[
{ "value" : "CheckBox1"},
{ "value" : "CheckBox3"}
]
}
The above will tick CheckBox1 and CheckBox3
Related
I have my app in Zapier CLI. I have created a trigger to set dropdown values for a particular action step during zap creation.
The data comes like this :
{ "data": {
"account_status": {
"field_name": "account_status",
"field_label": "Status",
"field_type": "list",
"field_length": "50",
"field_items": "Active|Inactive|444|Closed",
"required": "0",
"related_module": "",
"related_field_name": "",
"join_table": "",
"join_lhs_field_name": "",
"join_rhs_field_name": "",
"related_data_field": ""
},
}
}
Here is my code:
Now I am trying to set the data for the dynamic dropdown using field_items value from the above result like this:
return responsePromise
.then(response => JSON.parse(response.content ) )
.then(data => {
const account_status_list = data.data.account_status.field_items;
const account_status_arr = account_status_list.split("|");
return account_status_arr.map(function(e){
e.id = e
return e
})
})
my input field for the dynamic dropdown trigger is:
{
key: 'account_status',
label:'Account Status',
required: false,
dynamic: 'account_status.account_dropdown.id'
}
On clicking the dropdown I get this error
Can anyone suggest where I am going wrong or what may I do to resolve this ?
David here, from the Zapier Platform team.
The issue is that Zapier expects an array of objects and you're returning an array of strings. It seems like you're trying to make an id field in your code snippet, but calling "Active".id = "Active" won't make an object.
Instead, you should change your map function to be something like the following:
return account_status_arr.map(function(e){
return {id: e}
})
The other thing you'll probably need to tweak is how your dynamic dropdown is set up. It's a period-separated string that follows the format trigger_key.id_key.label_key. The id and label can be the same key; it really depends on what data you need to send to the API (the label is just for show, the id is what's actually sent). In the dynamic field, you'll have a dyanmic property that'll be account_status.id.id.
There are docs here.
I am new to elastisearch and I just set it up and tried default search. I am using elasticsearch rails gem. I need to write custom query with priority search (some fields in table are more important then others, etc. title, updated_at in last 6 months...). I tried to find explanation or tutorial for how to do this but nothing seems understandable. Can anyone help me with this, soon better.
Never having used the ruby/elasticsearch integration, it doesn't seem too hard... The docs here show that you'd want to do something like this:
client.search index: 'my-index', body: { query: { match: { title: 'test' } } }
To do a basic search.
The ES documentation here shows how to do a field boosted query:
{
"multi_match" : {
"query" : "this is a test",
"fields" : [ "subject^3", "message" ]
}
}
Putting it all together, you'd do something like this:
client.search index: 'my-index', body: { query: { multi_match : {
query : "this is a test",
fields : [ "subject^3", "message" ]
} } }
That will allow you to search/boost on fields -- in the above case, the subject field is given 3 times the score of the message field.
There is a very good blog post about how to do advanced scoring. Part of it shows an example of adjusting the score based on a date:
...
"filter": {
"exists": {
"field": "date"
}
},
"script": "(0.08 / ((3.16*pow(10,-11)) * abs(now - doc['date'].date.getMillis()) + 0.05)) + 1.0"
...
I have done in php, Never used the gem from Ruby on rails. Here you can give the priority for the fields using the caret (^) notation.
Example:- Suppose if we have fields namely name, email, message and address in table and the priority should be given for the name and message then you can write as below
> { "multi_match" : {
> "query" : "this is a test",
> "fields" : [ "name^3", "message^2".... ] } }
Here name has 3 times higher priority than other fields and message has got 2 times higher priority than other fields.
I have this json model:
model/data.json
{
"orders" : [
{
"header" : { "id" : "00001", "description" : "This is the first order" },
"items" : [
{ "name" : "Red Book","id" : "XXYYZZ" },
{ "name" : "Yellow Book", "id" : "AACCXX" },
{ "name" : "Black Book", "id" : "UUEEAA" },
]
},
{
// another order with header + items
},
.....
]
}
and I'm assigning it onInit to the view, like this:
var model = new sap.ui.model.json.JSONModel("model/data.json");
sap.ui.getCore().setModel(reqModel);
I'm trying to display a list of orders in the first view (showing the id), like this:
var list = new sap.m.List({
id: "mainList",
items: []
});
var items = new sap.m.ActionListItem({
text : "{id}",
press : [ //click handler, onclick load the order details page ]
});
list.bindItems("/orders", items);
.... // add list to the page etc etc
What I cannot do, is connect each order to its header->id.. I tried
text: "/header/{id}"
text: "{/header/id}"
in the items declaration, and
list.bindItems("/orders/header", items)
in the list binding, but none of them works.. The id value is not displayed, even though a "blank" list item is shown..
Any idea? What am I doing wrong?
Thank you
The solution was one of those I tried (but I don't know why it didn't work at that time)
text: "{/header/id}"
The ListItem acts as a Template for a list/array of objects. That's why you bind it against an array structure in your data:
list.bindItems("/orders", itemTemplate)
That makes bindings of the ListItem relative to /orders and therefore your item should look like this without leading '/' (absolute paths would look like this /orders/0/header/id asf.):
var itemTemplate = new sap.m.ActionListItem({
text : "{header/id}",
press : [ //click handler, onclick load the order details page ]
});
Not quite sure how you made it work the way you have shown... May be it's not as picky as I thought.
Btw: For whatever reason the ResourceModel builds an exception of that syntax. You can always omit the leading '/' when dealing with ResourceModels (probably because they do not allow nested structures).
BR
Chris
Cannot add comments yet, therefore an answer to you solved Problem, that could answer the initial problem. (And inform People using that example in any way)
In the current code listing you use the variable "reqModel" to set the model, but the variable with the model in it is named "model" in the line before. Maybe that was the first reason why both of your examles would not work?
Perhaps this error was cleared on rewriting some passages while testing.
greetings! -nx
I am trying to run queries against the JIRA API and get results in which I can see the dates and times that each issue went through a status change.
E.g.: Run a query to grab all issues with a certain assignee and see, along with the rest of the information, timestamps for when each issue changed from "Open" to "Resolved".
Is this possible?
EDIT: I have tried expanding the changelog, but while that tells me what status changes a ticket went through (e.g., that the particular ticket transitioned from "Open" to "Resolved" and then from "Resolved" to "Closed"), it doesn't tell me WHEN these transitions occurred.
Turns out that each of the transition objects showing the status changes have a "created" field that contains the time and date the transition occurred, which I feel is a bit of a misnomer, but there it is. An example object inside the "histories" array in the expanded changelog object:
{ "author" : { "active" : true,
"avatarUrls" : { "16x16" : "https://company.jira.com/secure/useravatar?size=xsmall&avatarId=10072",
"24x24" : "https://company.jira.com/secure/useravatar?size=small&avatarId=10072",
"32x32" : "https://company.jira.com/secure/useravatar?size=medium&avatarId=10072",
"48x48" : "https://company.jira.com/secure/useravatar?avatarId=10072"
},
"displayName" : "First Last",
"emailAddress" : "first.last#company.com",
"name" : "first.last",
"self" : "https://company.jira.com/rest/api/2/user?username=first.last"
},
"created" : "2013-04-17T16:21:13.540-0400",
"id" : "24451",
"items" : [ { "field" : "status",
"fieldtype" : "jira",
"from" : "5",
"fromString" : "Resolved",
"to" : "6",
"toString" : "Closed"
},
{ "field" : "assignee",
"fieldtype" : "jira",
"from" : "old.assignee",
"fromString" : "Old Assignee",
"to" : "first.last",
"toString" : "First Last"
}
]
}
I have this simple model:
abstract class Info {
ObjectId id
Date dateCreated
Date lastUpdated
}
class Question extends Info {
String title
String content
List<Answer> answers = []
static embedded = ['answers']
}
class Answer {
String content
}
Written this way, answer are embedded in question (and no id is maintained for answer). I want to maintain the id, dateCreated, and lastUpdated fields for every answer. So I try the following:
class Answer extends Info {
String content
}
When I run a simple test case (save a question with 1 answer), I get the following:
> db.question.find()
{ "_id" : ObjectId("4ed81d47e4b0777d795ce3c4"), "answers" : [ { "content" : "its very
cool", "dateCreated" : null, "lastUpdated" : null, "version" : null } ], "content" :
"whats up with mongodb?", "dateCreated" : ISODate("2011-12-02T00:35:19.303Z"),
"lastUpdated" : ISODate("2011-12-02T00:35:19.303Z"), "title" : "first question",
"version" : 0 }
I notice here that fields dateCreated and lastUpdate are not auto-maintained by Grails. Also version field was added but has a null value as well, but interestingly no _id field created (even if I defined id in Info class).
In a second scenario, I try this:
class Answer {
ObjectId id
String content
}
and I get the following output:
> db.question.find()
{ "_id" : ObjectId("4ed81c30e4b076cb80ec947d"), "answers" : [ { "content" : "its very
cool" } ], "content" : "whats up with mongodb?", "dateCreated" : ISODate("2011-12-
02T00:30:40.233Z"), "lastUpdated" : ISODate("2011-12-02T00:30:40.233Z"), "title" :
"first question", "version" : 0 }
This time, id is also not created for the embedded document. Any explanation for this scenarios ? Why there is no id property, and why dateCreated, lastUpdated, and version are null? Is this intended to work this way, or is it a bug?
Thank you,
this is probably due to how the grails framework does the conversion (the GORM module).
You may have quicker / better answers from the grails forum.
Basically it seems that some of the automatic behavior (fill in dates and objectid) is only done for the root object, not subobjects.
You can also checkout an alternative ORM based on morphia:
http://www.grails.org/plugin/mongodb-morphia