This topic contains 5 replies, has 0 voices, and was last updated by chanarbon 7 years, 5 months ago.
-
AuthorPosts
-
November 29, 2016 at 4:40 pm #1444
seamanjeffAnyone have some sample code to create the simplest possible search of a custom record, and run it ad hoc?
This is a cached copy. Click here to see the original post. -
November 29, 2016 at 5:06 pm #1445
david.smithhttps://chrome.google.com/webstore/d…epdmfaihdokglp
-
November 29, 2016 at 6:53 pm #1446
chanarbonHi @seamanjeff,
You just have to set the type on the search as the script id of the search that you are about to create
Code:
search.create({
type : “customrecord_mycustrecord”,
filters : [],
columns : [
“custrecord_field1”,
“custrecord_field2”
]
}) -
May 19, 2017 at 11:45 am #1447
ialanCould you show the sample code to retrieve the results as well?
-
May 19, 2017 at 12:09 pm #1448
david.smithUse of the Chrome extension will give you this.
There are multiple ways of running the search but the easiest would look something like this:
Code:
var searchObj = search.create({
type : “customrecord_mycustrecord”,
filters : [],
columns : [
“custrecord_field1”,
“custrecord_field2″
]
});var searchResultCount = searchObj.runPaged().count;
searchObj.run().each(function(result){
// .run().each has a limit of 4,000 resultsvar field1 = result.getValue({name:”custrecord_field1″});
var field2_text = result.getText({name:”custrecord_field2”});return true; // return must be true in order to iterate all results.
}); -
May 29, 2017 at 1:44 pm #1449
chanarbonialan
the result object has functions getValue() for general purpose and getText() to get the text presentation of an list/record field.
-
AuthorPosts
You must be logged in to reply to this topic.
