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.

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);
  • 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. – SFDC Mafia - VIC Nov 16 '17 at 9:27
  • @SFDCMafia-Vickal I just tried with git-hub now, it was deployed successfully – NITHESH K Nov 16 '17 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.