You need to sign in to do that
Don't have an account?
varun singh 22
How to access active status of workflow or validation rule using metadata and tooling api?
Hi All,
I have done with metadata api and access id,name and object (on which they are active or inactive) of workflow and validation rule
but i am unbale to access active field (means workflow is active or not )
this is my code
public void showvaidation() {
display=true;
inputtyp=ApexPages.currentPage().getParameters().get('input');
system.debug('result **************************'+inputtyp);
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
List
<MetadataService.ListMetadataQuery>
queries = new List
<MetadataService.ListMetadataQuery>
();
MetadataService.ListMetadataQuery queryLayout = new MetadataService.ListMetadataQuery();
queryLayout.folder = '';
queryLayout.type_x = inputtyp;
queries.add(queryLayout);
MetadataService.FileProperties[] fileProperties = service.listMetadata(queries, 25);
if(fileProperties!=null)
{
siteurl=Url.getSalesforceBaseUrl().toExternalForm() ;
vdata=new list
<metawrapper>
();
for(MetadataService.FileProperties fileProperty : fileProperties)
{
System.debug(fileProperty.active);
System.debug('file name **********'+fileProperty.ID);
if(fileProperty.FullName.contains(listvalue)){
vdata.add(new metawrapper(fileProperty.id,fileProperty.fullname));
}
}
}
}
thanks in advance
I have done with metadata api and access id,name and object (on which they are active or inactive) of workflow and validation rule
but i am unbale to access active field (means workflow is active or not )
this is my code
public void showvaidation() {
display=true;
inputtyp=ApexPages.currentPage().getParameters().get('input');
system.debug('result **************************'+inputtyp);
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
List
<MetadataService.ListMetadataQuery>
queries = new List
<MetadataService.ListMetadataQuery>
();
MetadataService.ListMetadataQuery queryLayout = new MetadataService.ListMetadataQuery();
queryLayout.folder = '';
queryLayout.type_x = inputtyp;
queries.add(queryLayout);
MetadataService.FileProperties[] fileProperties = service.listMetadata(queries, 25);
if(fileProperties!=null)
{
siteurl=Url.getSalesforceBaseUrl().toExternalForm() ;
vdata=new list
<metawrapper>
();
for(MetadataService.FileProperties fileProperty : fileProperties)
{
System.debug(fileProperty.active);
System.debug('file name **********'+fileProperty.ID);
if(fileProperty.FullName.contains(listvalue)){
vdata.add(new metawrapper(fileProperty.id,fileProperty.fullname));
}
}
}
}
thanks in advance
there are output but i am unable to access active status it showing wrong value