You need to sign in to do that
Don't have an account?
kumar_arun
How to query fullName of "Layout" using Tooling Api ?
Hi, everyone
I want to get All Layout of a salesforce org, In that, i also need to get all objects count on which these "Layout". I am using Tooling API to get all "Layout", I get all layout and its count but i am not getting Object Name on which these layout. When i query "fullName" then getting error: -
[{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 2083828647-227657 (1162229940)","errorCode":"UNKNOWN_EXCEPTION"}] .
please help.
I want to get All Layout of a salesforce org, In that, i also need to get all objects count on which these "Layout". I am using Tooling API to get all "Layout", I get all layout and its count but i am not getting Object Name on which these layout. When i query "fullName" then getting error: -
[{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 2083828647-227657 (1162229940)","errorCode":"UNKNOWN_EXCEPTION"}] .
please help.
public with sharing class LayoutMetadataCntrl { public list<string> LayoutName{get;set;} public string TotalLayout{get;set;} public LayoutMetadataCntrl (){ LayoutName=new list<string>(); TotalLayout=''; } public void PageLayout(){ HttpRequest req=new HttpRequest(); req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID()); req.setHeader('content-Type','application/json'); string domainUrl=URL.getSalesforceBaseUrl().toExternalForm(); req.setEndpoint(domainUrl+'/services/data/v33.0/tooling/query/?q=Select+id,name,createdDate,fullName+from+Layout'); req.setMethod('GET'); Http h=new Http(); HttpResponse res=h.send(req); system.debug(res.getBody()); if(res.getStatusCode()==200){ JsonParser parser=JSON.createParser(res.getBody()); while(parser.nextToken() !=null){ if((parser.getCurrentToken()==JSONToken.FIELD_NAME)&& (parser.getText()=='Name')){ parser.nextValue(); LayoutName.add(parser.getText()); } if((parser.getCurrentToken()==JSONToken.FIELD_NAME)&&(parser.getText()=='Size')){ parser.nextValue(); TotalLayout=parser.getText(); } } } } }
May I request you to please refer the below link for reference.
- https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_layout.htm
I hope it will be helpful.Best Regards
Rahul Kumar