This documentation supports the 20.02 version of BMC Helix Platform.To view the documentation for the current version, select 20.08 from the Product version menu.

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

Creating-custom-view-components

Creating-custom-view-components-for-record-editor

Enabling-browser-logging-in-a-Digital-Service-application

Enabling-logging-for-a-Digital-Service-application

Naming-conventions-for-angular-objects

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*