Examples of AngularJS services
The following code snippets are examples of using AngularJS services. You can use these services to create a new record instance, get record instance data, update record instance data, get configuration data, and get user data.
Get data page from record
var queryParams = {
propertySelection: "179,7", // ids of fields to get
queryExpression: "'7'!= 3" //not rejected
};
var foo = rxRecordInstanceDataPageResource.withName('<package>:<recordname>');
foo.get(1000,0,queryParams).then()
Get user data
rxCurrentUser.get()
Get configuration data
AdminSettingResource.getComponentSettingData('test').then(function(data) {
$scope.mode=data.values[0].settingValue;
});
Create a new record instance
var objectRecord = rxRecordInstanceResource.withName('de.materna.tf.TestTF:Object');
var createRecord = function () {
objectRecord.getNew().then(function (record) {
var fields = record.fieldInstances;
fields[536870917].value = 0;
fields[8].value = 'test description';
return objectRecord.post(record);
});
};
Get a record
var objectRecord = rxRecordInstanceResource.withName('de.materna.tf.TestTF:Object');
objectRecord.get('IDxzy').then(
function(record) {
console.log(record.getValue(8));
}
);
Update a record
var objectRecord = rxRecordInstanceResource.withName('de.materna.tf.TestTF:Object');
objectRecord.get('IDxzy').then(
function(record) {
record.setValue(8, 'new description');
record.put();
}
);
Related topics
Example of creating a custom view component
Was this page helpful? Yes No
Submitting...
Thank you
Comments
Log in or register to comment.