$GUID = "810Pu000001MruoIAC"
$getContracturl = "https://MYSANDBOX.my.salesforce.com/services/data/v57.0/query?q=SELECT+FIELDS(ALL)+FROM+servicecontract+WHERE+id+=+'$GUID'+LIMIT+50"
$getContractResponse = Invoke-RestMethod -Uri $getContracturl -Method 'Get' -Headers $headers -TimeoutSec 0.03
$getContractResponse | ConvertTo-Json -Depth 10
$accountid = $getContractResponse.records.accountid
$dat_size = "150"
$lic_365 = "1"
$lic_google = "1"
$createUrl = "https://MYSANDBOX.my.salesforce.com/services/data/v57.0/sobjects/Usage_Billing__c"
$requestbody =@"
{
"Service_Contract__c" : $GUID,
"Stor__c" : $dat_size,
"X365_Users__c" : $lic_365,
"G_Users__c" : $lic_google
}
"@
Write-Host $requestbody
$createBilling = Invoke-RestMethod -Uri $createUrl -Method 'Post' -Headers $headers -Body $requestbody -TimeoutSec 0.03
$createBilling | ConvertTo-JSON
Anyone able to point me in the right direction?
All help appreciated.AndyNever mind, realised I didn't encapsulate the $GUID variable in quotations. "Service_Contract__c" : "$GUID",All working now - will leave this here in case anyone else comes across same issue (shows that something simple can waste loads of time :) )