Avatar

Performing Actions from List View using API

David Mowry

So I am looking to add an action on my custom list view that will take the user to create a new record in another app. 

I have two methods to do this but I have questions for both.

1. First method I though of was to use strictly the API to create the relationship between the two apps. This is where I got lost and couldn't figure out how to do this from a custom view.  If someone has any ideas, can you provide an example? 

2. Second would be to create an action first on the main app to establish the link between the two apps. I could then recreate the actions URL in my custom view, I have been able to do this...but seems like there might be a better way. Is there an API call that I can make to retrieve an apps available actions and retrieve the ID of that action?

Here is the code that I've put together for the URL on the custom view.


var kintoneSubDomain = 'https://{subdomain}.kintone.com/k/';
var mainAppId = {mainAppID};
var secondAppId = {secondAppID};
Link.href = kintoneSubDomain + secondAppId + '/edit?action={actionID}&app=' + mainAppId + '&record=' + recordID;

 

Follow 2 followers
1

1 comment

Avatar
Sean Tachibana 1 vote
Hello David,
 
>So I am looking to add an action on my custom list view that will take the user to create a new record in another app.
 
This procedure is possible by using the Kintone REST API "POST" to add records into an App.
 
※ <App ID>: Specify the app ID of the app to add a record.
 
※ This is an example of adding a record by setting the value in the request to the "String (first row)" field of the field code "str" and the "Number" field of the field code "num."
 
var parm = {

'app':<App ID>,

'record':{

'str':{

'value': "test",

},

'num':{

'value': 1,

},

},

};

kintone.api(

'/k/v1/record',

'POST',

parm,

function(event){

console.log(event);},

function(err){

console.log(err);

}

);

Add Records:
 
Also, since this is a customized view, the value to be set is retrieved from the event object in the record list screen display event, or the value of the record is retrieved by the batch record retrieval process "GET."
 
Get Records:
 
Hopefully, this resolves your issue.
1
Comment actions Permalink