• Curious95
  • NEWBIE
  • 10 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 8
    Replies
I am looking at this formula:

DATETIMEVALUE(({!$Record.B25__StartLocal__c})-4/24)

What does -4/24 means? Minus 0.1666 (4/24=0.1666)?  What does this formula do? If this is minus 4 hours due to Day Light Saving, how can I have a generic fucntion that covers both Eastern Standard Time and Day Light Saving, wthout manually change 4 to 5 when it is back to Eastern Standard Time?

Thanks for help!

Thanks! 
I was given a Salesforce integration project. I use Apache HTTP Client and Salesforce REST API to create objects. The following code is working without any problem:
 
CloseableHttpClient httpclient = HttpClients.createDefault(); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("client_id", consumerKey)); params.add(new BasicNameValuePair("client_secret", consumerSecret)); params.add(new BasicNameValuePair("grant_type", "client_credentials")); HttpPost post = new HttpPost("https://.....my.salesforce.com/services/oauth2/token"); post.setEntity(new UrlEncodedFormEntity(params)); HttpResponse loginResponse = httpclient.execute(post); ObjectMapper mapper = new ObjectMapper(); JsonNode loginResult = mapper.readValue(loginResponse.getEntity().getContent(), JsonNode.class); String accessToken = loginResult.get("access_token").asText(); String instanceUrl = loginResult.get("instance_url").asText(); String uri = instanceUrl + "/services/data/v57.0/sobjects/conference360__Event__c" ; HttpPost httpPost = new HttpPost(uri); httpPost.addHeader("Authorization", "Bearer " + accessToken); httpPost.addHeader("Content-Type", "application/json"); JSONObject data = new JSONObject(); data.put("Name": "test meeting"); data.put("conference360__Event_Start_Date__c": "2023-02-27"); data.put("conference360__Event_End_Time__c": "12:13:00.000Z"); data.put("conference360__Event_End_Date__c": "2023-02-27"); data.put("conference360__Event_Start_Time__c": "12:12:00.000Z"); data.put("conference360__Time_Zone__c": "America/New_York"); StringEntity body = new StringEntity(data.toString(1), ContentType.create("application/json")); httpPost.setEntity(body); CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(httpPost);


However, I always got the same error and I got more error info via the following code:
 
System.out.println(response.getStatusLine().getStatusCode());
System.out.println(response.getStatusLine().getReasonPhrase());

Here is the output:
 
400
Bad Request

This info is almost useless and misleading. I used POSTMAN to create (POST) the same object, and I got the error message showing the real reason for failure:

We can't save this record because the “Event & Case Creation from Room Booking” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to create records: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: conference360.Event_Trigger: execution of AfterInsert\n\ncaused by: System.QueryException: Insufficient permissions: secure query included inaccessible field\n\n(conference360). You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 2052924026-11322 (-1519010228)k up ExceptionCode values in the SOAP API Developer Guide. Error ID: 2052924026-11322 (-1519010228)", "errorCode":"CANNOT_EXECUTE_FLOW_TRIGGER","fields":[]

My question is: how to reveal the same error message in Java?


 


 
I need to use REST API to insert a record into a table called:

conference360__Event__c

This table has the follow four fields:

conference360__Event_Start_Date__c
conference360__Event_Start_Time__c
conference360__Event_End_Date__c
conference360__Event_End_Time__c

and I need put values in these fields when inserting a record into the table. 

The problem is that when inserting a record into this table, I always get the following error message for any of these four fields:

We can't save this record because the “Event & Case Creation from Room Booking” process failed. Give your Salesforce admin these details. 
This error occurred when the flow tried to create records: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: conference360.Event_Trigger: execution of AfterInsert\n\ncaused by: 
System.QueryException: Insufficient permissions: secure query included inaccessible field\n\n(conference360). You can look up ExceptionCode values in the SOAP API Developer Guide. 
Error ID: 2052924026-11322 (-1519010228)k up ExceptionCode values in the SOAP API Developer Guide. Error ID: 2052924026-11322 (-1519010228)",
"errorCode":"CANNOT_EXECUTE_FLOW_TRIGGER","fields":[]

How to solve this type of problem? I went to the setup and it seems that these fields are managed and I can't do anything that can fix the problem. Is there a place to configure these fields so that the REST API code can insert values into them?

I am new to Salesforce, and any input would be really appreciated.

Thank you!


 
I am trying to create an object in a custom table through Salesforce REST API. The table is called B25__Reservation__c. The application is Booker25. Here is the code:
CloseableHttpClient httpClient = HttpClients.createDefault();

    List<NameValuePair> loginParams = new ArrayList<NameValuePair>();
    loginParams.add(new BasicNameValuePair("client_id", CONSUMER_KEY));
    loginParams.add(new BasicNameValuePair("client_secret", CONSUMER_SECRET));
    loginParams.add(new BasicNameValuePair("grant_type", "client_credentials")); 
    
    HttpPost post = new HttpPost(LOGINURL_FULL);
    post.setEntity(new UrlEncodedFormEntity(loginParams));

    final HttpResponse loginResponse = httpClient.execute(post);

    final ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    
    JsonNode loginResult = mapper.readValue(loginResponse.getEntity().getContent(), JsonNode.class);
    
    String accessToken = loginResult.get("access_token").asText();
    String instanceUrl = loginResult.get("instance_url").asText();
    
    JSONObject data = new JSONObject();
    data.put("B25__Title__c", "Test title");
    data.put("B25__Start__c", "2023-02-25T13:00:00.000+0000");
    data.put("B25__End__c", "2023-02-25T18:00:00.000+0000");
    data.put("B25__Start_Date__c", "2023-02-24");
    data.put("B25__End_Date__c", "2023-02-24");
    data.put("B25__Resource__c", "a3C8c00230ddd000");
    data.put("Reserved_For__c", "003DV0000234545");
    data.put("OwnerId", "0058c00000B123455");
            
    String uri = instanceUrl + "/services/data/v56.0/sobjects/B25__Reservation__c";
    HttpPost httpPost = new HttpPost(uri);
    
    httpPost.addHeader("Authorization", "Bearer " + accessToken);
    httpPost.addHeader(new BasicHeader("X-PrettyPrint", "1"));
            
    StringEntity body = new StringEntity(data.toString(1));
    body.setContentType("application/json");
    httpPost.setEntity(body);
    
    HttpResponse queryResponse = httpClient.execute(httpPost);
When running the code, I always get "Bad Request" response, and there is no additional information. For the same data and end point, I tried it at https://workbench.developerforce.com/, there was no problem creating the object. I did a test by changing the end point to
 
/services/data/v56.0/sobjects/Account
and data to
JSONObject data = new JSONObject();
    data.put("Name", "Test name");

the above code works without any problem (The response came back with the 201 status)

Anything wrong with the above code for creating an object in a custom table?



 

I am looking at this formula:

DATETIMEVALUE(({!$Record.B25__StartLocal__c})-4/24)

What does -4/24 means? Minus 0.1666 (4/24=0.1666)?  What does this formula do? If this is minus 4 hours due to Day Light Saving, how can I have a generic fucntion that covers both Eastern Standard Time and Day Light Saving, wthout manually change 4 to 5 when it is back to Eastern Standard Time?

Thanks for help!

Thanks! 
I was given a Salesforce integration project. I use Apache HTTP Client and Salesforce REST API to create objects. The following code is working without any problem:
 
CloseableHttpClient httpclient = HttpClients.createDefault(); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("client_id", consumerKey)); params.add(new BasicNameValuePair("client_secret", consumerSecret)); params.add(new BasicNameValuePair("grant_type", "client_credentials")); HttpPost post = new HttpPost("https://.....my.salesforce.com/services/oauth2/token"); post.setEntity(new UrlEncodedFormEntity(params)); HttpResponse loginResponse = httpclient.execute(post); ObjectMapper mapper = new ObjectMapper(); JsonNode loginResult = mapper.readValue(loginResponse.getEntity().getContent(), JsonNode.class); String accessToken = loginResult.get("access_token").asText(); String instanceUrl = loginResult.get("instance_url").asText(); String uri = instanceUrl + "/services/data/v57.0/sobjects/conference360__Event__c" ; HttpPost httpPost = new HttpPost(uri); httpPost.addHeader("Authorization", "Bearer " + accessToken); httpPost.addHeader("Content-Type", "application/json"); JSONObject data = new JSONObject(); data.put("Name": "test meeting"); data.put("conference360__Event_Start_Date__c": "2023-02-27"); data.put("conference360__Event_End_Time__c": "12:13:00.000Z"); data.put("conference360__Event_End_Date__c": "2023-02-27"); data.put("conference360__Event_Start_Time__c": "12:12:00.000Z"); data.put("conference360__Time_Zone__c": "America/New_York"); StringEntity body = new StringEntity(data.toString(1), ContentType.create("application/json")); httpPost.setEntity(body); CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(httpPost);


However, I always got the same error and I got more error info via the following code:
 
System.out.println(response.getStatusLine().getStatusCode());
System.out.println(response.getStatusLine().getReasonPhrase());

Here is the output:
 
400
Bad Request

This info is almost useless and misleading. I used POSTMAN to create (POST) the same object, and I got the error message showing the real reason for failure:

We can't save this record because the “Event & Case Creation from Room Booking” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to create records: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: conference360.Event_Trigger: execution of AfterInsert\n\ncaused by: System.QueryException: Insufficient permissions: secure query included inaccessible field\n\n(conference360). You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 2052924026-11322 (-1519010228)k up ExceptionCode values in the SOAP API Developer Guide. Error ID: 2052924026-11322 (-1519010228)", "errorCode":"CANNOT_EXECUTE_FLOW_TRIGGER","fields":[]

My question is: how to reveal the same error message in Java?


 


 
I need to use REST API to insert a record into a table called:

conference360__Event__c

This table has the follow four fields:

conference360__Event_Start_Date__c
conference360__Event_Start_Time__c
conference360__Event_End_Date__c
conference360__Event_End_Time__c

and I need put values in these fields when inserting a record into the table. 

The problem is that when inserting a record into this table, I always get the following error message for any of these four fields:

We can't save this record because the “Event & Case Creation from Room Booking” process failed. Give your Salesforce admin these details. 
This error occurred when the flow tried to create records: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: conference360.Event_Trigger: execution of AfterInsert\n\ncaused by: 
System.QueryException: Insufficient permissions: secure query included inaccessible field\n\n(conference360). You can look up ExceptionCode values in the SOAP API Developer Guide. 
Error ID: 2052924026-11322 (-1519010228)k up ExceptionCode values in the SOAP API Developer Guide. Error ID: 2052924026-11322 (-1519010228)",
"errorCode":"CANNOT_EXECUTE_FLOW_TRIGGER","fields":[]

How to solve this type of problem? I went to the setup and it seems that these fields are managed and I can't do anything that can fix the problem. Is there a place to configure these fields so that the REST API code can insert values into them?

I am new to Salesforce, and any input would be really appreciated.

Thank you!


 
I am trying to create an object in a custom table through Salesforce REST API. The table is called B25__Reservation__c. The application is Booker25. Here is the code:
CloseableHttpClient httpClient = HttpClients.createDefault();

    List<NameValuePair> loginParams = new ArrayList<NameValuePair>();
    loginParams.add(new BasicNameValuePair("client_id", CONSUMER_KEY));
    loginParams.add(new BasicNameValuePair("client_secret", CONSUMER_SECRET));
    loginParams.add(new BasicNameValuePair("grant_type", "client_credentials")); 
    
    HttpPost post = new HttpPost(LOGINURL_FULL);
    post.setEntity(new UrlEncodedFormEntity(loginParams));

    final HttpResponse loginResponse = httpClient.execute(post);

    final ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    
    JsonNode loginResult = mapper.readValue(loginResponse.getEntity().getContent(), JsonNode.class);
    
    String accessToken = loginResult.get("access_token").asText();
    String instanceUrl = loginResult.get("instance_url").asText();
    
    JSONObject data = new JSONObject();
    data.put("B25__Title__c", "Test title");
    data.put("B25__Start__c", "2023-02-25T13:00:00.000+0000");
    data.put("B25__End__c", "2023-02-25T18:00:00.000+0000");
    data.put("B25__Start_Date__c", "2023-02-24");
    data.put("B25__End_Date__c", "2023-02-24");
    data.put("B25__Resource__c", "a3C8c00230ddd000");
    data.put("Reserved_For__c", "003DV0000234545");
    data.put("OwnerId", "0058c00000B123455");
            
    String uri = instanceUrl + "/services/data/v56.0/sobjects/B25__Reservation__c";
    HttpPost httpPost = new HttpPost(uri);
    
    httpPost.addHeader("Authorization", "Bearer " + accessToken);
    httpPost.addHeader(new BasicHeader("X-PrettyPrint", "1"));
            
    StringEntity body = new StringEntity(data.toString(1));
    body.setContentType("application/json");
    httpPost.setEntity(body);
    
    HttpResponse queryResponse = httpClient.execute(httpPost);
When running the code, I always get "Bad Request" response, and there is no additional information. For the same data and end point, I tried it at https://workbench.developerforce.com/, there was no problem creating the object. I did a test by changing the end point to
 
/services/data/v56.0/sobjects/Account
and data to
JSONObject data = new JSONObject();
    data.put("Name", "Test name");

the above code works without any problem (The response came back with the 201 status)

Anything wrong with the above code for creating an object in a custom table?