0

I did some research on this, found bit difficult to implement the solution. Looking for easiest way/solution.

I need get related Validation Rules, Workflow Rules etc when I select an object on VF page. I may need to get those in PDF or excel, but that's other part of implementation. I did not found any difficulties while getting Objects descriptions and its field descriptions. But getting validation and Workflows seems to be little lengthy as per my finding.

3
  • What did you find so far in your research but didn't work for you?
    – Folkert
    Nov 16, 2017 at 9:13
  • This one is the one... developer.salesforce.com/forums/?id=906F0000000Ai6kIAC And most of them are having same way of implementation, which is using Metadata API, and It requires some files to be deployed from Git. I attempted to deploy but it was unsuccessful. I'm looking for some System or Standard Methods if there is any.
    – Vickal
    Nov 16, 2017 at 9:18
  • I'm afraid that metadata api wrapper is the only way to do it. Describe methods in Apex only give information on fields, object permissions, etc developer.salesforce.com/docs/atlas.en-us.apexcode.meta/…
    – Folkert
    Nov 16, 2017 at 9:23

1 Answer 1

1

I have not tried it myself, but i hope this link can help you.

Reference : how-to-search-workflow-rules-or-validation-rules-etc-in-apex-i-e-metadata-search

This will allow you to list the Validation Rules and Workflow Rules from Apex.

   MetadataService.MetadataPort service = MetadataServiceExamples.createService();     
    List<MetadataService.ListMetadataQuery> queries = new List<MetadataService.ListMetadataQuery>();        
    MetadataService.ListMetadataQuery queryWorkflow = new MetadataService.ListMetadataQuery();
    queryWorkflow.type_x = 'WorkflowRule';
    queries.add(queryWorkflow);     
    MetadataService.ListMetadataQuery queryValidationRule = new MetadataService.ListMetadataQuery();
    queryValidationRule.type_x = 'ValidationRule';
    queries.add(queryValidationRule);           
    MetadataService.FileProperties[] fileProperties = service.listMetadata(queries, 25);
    for(MetadataService.FileProperties fileProperty : fileProperties)
        System.debug(fileProperty.fullName);
2
  • It requires some files(MetadataService, MetadataServiceExamples,) to be deployed from Git. I attempted to deploy but it was unsuccessful. Do you have any idea how do we get those dependent Metadata Classes files.
    – Vickal
    Nov 16, 2017 at 9:27
  • @SFDCMafia-Vickal I just tried with git-hub now, it was deployed successfully
    – NITHESH K
    Nov 16, 2017 at 9:51

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .