Finding a Custom Object Id (01I…) to get the Setup page URL
来源:互联网 发布:mac还是nars口红好用 编辑:程序博客网 时间:2024/05/05 19:17
//choose your object name (without suffix!)String objectName = 'Work';String query = 'SELECT Id From CustomObject Where DeveloperName = \'' + objectName + '\'';String endpoint = Url.getSalesforceBaseUrl().toExternalForm();endpoint += '/services/data/v29.0/tooling/query/?q=';endpoint += EncodingUtil.urlEncode(query, 'UTF-8');HttpRequest request = new HttpRequest();request.setMethod('GET');request.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId());request.setEndpoint(endpoint);HttpResponse response = new Http().send(request);Id customObjectId = response.getBody().substringAfter('"Id":"').substringBefore('"');//eg '01Id0000001BSeoEAG'System.debug(customObjectId);
Which will give you something like:
'01Id0000001BSeoEAG'
parsed from the raw response:
{ "size": 1, "totalSize": 1, "done": true, "records":[{ "attributes": { "type": "CustomObject", "url": "/services/data/v29.0/tooling/sobjects/CustomObject/01Id0000001BSeoEAG" }, "Id": "01Id0000001BSeoEAG" }], "queryLocator":null, "entityTypeName":"CustomEntityDefinition"}
0 0
- Finding a Custom Object Id (01I…) to get the Setup page URL
- PHP: How to Get the Current Page URL
- From an inner class, "this" points to the inner object. How do I get a "this" pointer to the enclosing object?
- Get the self URL of current page
- PHP Get the Current Page URL
- How to get controlToValidate ID base on Custom Validator
- How To Retrieve the URL of a Web Page from an ActiveX Control
- Inno Setup:Creating custom wizard page
- How to get the process ID to kill a nohup process?
- How do I get the reference count of a CLR object?
- How can I get a FlowDocument Hyperlink to launch browser and go to URL in a WPF app?
- Liferay on Private Site to get Public Site Page URL
- command to get the man page content to file
- Create a Custom Master Page
- finding the registered URL protocols
- How to get parameters from the URL?
- IE title changes to <afterHash> if the page has a url with '#' , and has flash/swf embedded in it
- How to redirect to a Custom Page for Event Receiver in SharePoint 2010
- 移动App该如何保存用户密码
- extern C的作用详解
- ORA-0107 invalid username/password;logon denied
- finished with non-zero exit value 1 解决办法
- LightOJ 1011 Marriage Ceremonies
- Finding a Custom Object Id (01I…) to get the Setup page URL
- linux修改ssh端口的二种方法
- Unity 实现Log实时输出到屏幕或控制台上<二>
- 不同平台字节对齐
- logstash 常见解决方法
- 【NGUI】Unity插件NGUI的Button按钮修改为Disabled状态
- LeetCode:Implement Stack using Queues
- C/C++中extern关键字详解
- net.sf.json.JSONException: Expected a ',' or '}' at character 65 of {"totalCount":343,"data":