1

I have an external application and I am trying to pass through a value using the Rest API URL queries, everything on it works, but when I try to add this one field (it is not custom), it sends me a 400 Bad Request.

The censored's are just more fields, I can't show due to compliance. If I were to remove IsAllDayEvent, it works, once I add it, the 400 appears again, and I double checked with Workbench to make sure I am using the right name. the {}'s are variables with values being passed.

$"{{\"censored\":\"{censored}\", \"IsAllDayEvent\":\"{isAllDayEvent}\", \"censored\":\"{censored}\", \"censored\":\"{censored}\", \"censored\":\"{censored}\", \"censored\":\"censored\", \"censored\":\"{censored}\", \"censored\":\"{censored}\"}}";

1 Answer 1

2

It's expecting a Boolean value, not a String, as this is a Checkbox field. Remove the quotes.

$"{... \"IsAllDayEvent\":{isAllDayEvent}, ...}";

For future reference, this is also true for number fields, such as currency.

8
  • Thank you, it didn't solve my problem, but you are right, I was doing it the wrong way. But the reason it is throwing a 400, is because in salesforce, if you select "All Day Event" then you can't have an enddatetime or startdatetime, which i had censored out. I am trying to send all day event AND the time's up. I will have to do some logic on my end to sort it out, but thanks!
    – CodyB
    Feb 26, 2020 at 16:09
  • @CodyB I'm just glad I could help point you in the right direction.
    – sfdcfox
    Feb 26, 2020 at 16:12
  • I put the logic in for it and the values being passed into it are correct, it is still not liking what I am trying to send. Im quite lost because this is a Salesforce issue that I cannot resolve. I have tried sending it as a boolean and as a string, even with different datetime formats.
    – CodyB
    Feb 26, 2020 at 19:09
  • @CodyB Check your "field level security" on the field. I found out it was disabled in my org, and that may be your problem to. Go to Setup > Object Manager > Event > Fields > All Day Event, and check the Field Level Security. You can't use the field if it is not Visible.
    – sfdcfox
    Feb 26, 2020 at 19:28
  • @CodyB Here's an example I used in workbench, so I know it works: { "subject": "Demo", "isAllDayEvent": true, "activityDate": "2020-01-01T00:00:00.000Z" }
    – sfdcfox
    Feb 26, 2020 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.