+ Start a Discussion
Yann COLLERYYann COLLERY 

How to get Assignment rules RuleEntry from Apex

Hi,

I need to get all the Assignment rules RuleEntry from apex.
I found the AssignmentRules metadata but I don't understand how to use it.

Would anyone know how to retrieve this information?

Thank you.
Best Answer chosen by Yann COLLERY
Tintu_BabuTintu_Babu
Hi Yann,

Add this github classes https://github.com/financialforcedev/apex-mdapi/tree/master/apex-mdapi/src/classes 


This is a sample example. You can use Assignment Rule Instead

String session = 'session';
String instance = 'https://na17.salesforce.com';
MetadataService.MetadataPort service = MetadataUtils.createService(session, instance);
List<MetadataService.ListMetadataQuery> queries = new List<MetadataService.ListMetadataQuery>();
MetadataService.ListMetadataQuery query = new MetadataService.ListMetadataQuery();
query.type_x = 'AssignmentRule';
queries.add(query);
// return all rule name in xml
MetadataService.FileProperties[] fileProperties = new List<MetadataService.FileProperties>();
// query metadata items by callout
fileProperties = service.listMetadata(queries, '30.0');

 

All Answers

siva sai 22siva sai 22
Hi I am new to technology i want to know where we have to post a question and what is exact def of APEX and why we will use <apex> for every controller
Tintu_BabuTintu_Babu
Hi Yann,

Add this github classes https://github.com/financialforcedev/apex-mdapi/tree/master/apex-mdapi/src/classes 


This is a sample example. You can use Assignment Rule Instead

String session = 'session';
String instance = 'https://na17.salesforce.com';
MetadataService.MetadataPort service = MetadataUtils.createService(session, instance);
List<MetadataService.ListMetadataQuery> queries = new List<MetadataService.ListMetadataQuery>();
MetadataService.ListMetadataQuery query = new MetadataService.ListMetadataQuery();
query.type_x = 'AssignmentRule';
queries.add(query);
// return all rule name in xml
MetadataService.FileProperties[] fileProperties = new List<MetadataService.FileProperties>();
// query metadata items by callout
fileProperties = service.listMetadata(queries, '30.0');

 
This was selected as the best answer