• syed furqan 1
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
How to get containerId/versionId of a dataset ? Previously we used to get this by turning on the SAQL mode, but after Summer 17 release it's only showing the dataset name, not the containerId/versionId names. Please let me know if we anyone has any idea how to get it.
How can we update a visualforce page from a class through Tooling API? I am using the below code which creates a Visualforce page called 'TestPageFromRest'. If I want to conditionally update the page next time, how can I do it? Please share the code if someone knows.

public class ToolingNewPage{

   
private static String baseUrl = URL.getSalesforceBaseUrl().toExternalForm() 
    + '/services/data/v28.0/tooling/';
public static void createPage() {
    
    String salesforceHost = System.Url.getSalesforceBaseURL().toExternalForm();

String url =  salesforceHost + '/services/data/v29.0/sobjects/ApexPage';

HttpRequest req = new HttpRequest();

req.setMethod('POST');
req.setEndpoint(url);
req.setHeader('Content-type', 'application/json');
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId());
//for controllerType = >0 -- no controller
req.setBody('{"Name" : "TestPageFromRest","Markup" : "<apex:page>hello</apex:page>","ControllerType" : "0","MasterLabel":"TestPageFromRest","ApiVersion":"29.0"}');

//for controllerType => 1 -- Standard controller + extensions        
//req.setBody('{"Name" : "TestPageFromRestCase","Markup" : "<apex:page standardController=\'case\' extensions=\'displaycase\'>hello</apex:page>","ControllerType" : "1","MasterLabel":"TestPageFromRestCase","ApiVersion":"29.0"}');

//for controllerType => 3 --custom Controller
//req.setBody('{"Name" : "TestPageFromRestCase1","Markup" : "<apex:page controller=\'displaycase\'>hello</apex:page>","ControllerType" : "3","MasterLabel":"TestPageFromRestCase1","ApiVersion":"29.0"}');            
Http http = new Http();

HTTPResponse res = http.send(req);
System.debug(res.getBody());
}}

 
  • January 17, 2017
  • Like
  • 0

Hi Guys,

 

We got an error that our code not Enforced SF CRUD and FLS(http://wiki.developerforce.com/index.php?title=Enforcing_CRUD_And_FLS) from Checkmarx report. we could not found anything wrrong in the code. please help me to resolve this issue,

---------------------------------------------
public class DefaultValues
{
public void SetDefaultValues()
{
if(Account.sObjectType.getDescribe().isCreateable())

if (Schema.sObjectType.Account.fields.Name.isCreateable() &&Schema.sObjectType.Account.fields.Description__c.isCreateable() && Schema.sObjectType.Account.fields.ObjectType__c.isCreateable() && Schema.sObjectType.Account.fields.EnabledStatus__c.isCreateable() )
{
List<Account> ListAccont=new List<Account>();
Account ObjAccountExact=new Account();
ObjAccountExact.Name='1st Pass - Strict';
ObjAccountExact.Description__c='Acct Name, Phone & City Exact';
ObjAccountExact.ObjectType__c='account';
ObjAccountExact.EnabledStatus__c='false';
ListAccont.Add(ObjAccountExact);
insert ListAccont;

}
}

}