I want to register a new Contract Object.
However, when I try to register it together with ShippingAddress, I get an error.
How do I add a ShippingAddress with a Contract Object?
■ Field is not writeable: Contract.ShippingAddres
Contract cont = (Contract) parser.readValueAsStrict(Contract.class);
Address a = new Address();
a.country = 'Japan';
a.city = 'Tokyo';
cont.ShippingAddress = a;
insert cont;
I ran New Contract in the GUI, and the second of the arrays has ShippingAddress registered.
I would like to do this with the Apex API as well.
■ The ShippingAddress of the second record is registered.
[
{
"attributes": {
"type": "Contract",
"url": "/services/data/v56.0/sobjects/Contract/8000T000000223IQAQ"
},
"Id": "8000T000000223IQAQ",
"AccountId": "0010T00000Ox7sSQAR",
"BillingAddress": null,
"ShippingAddress": null,
"OwnerId": "0055g00000GRB5vAAH",
"Status": "Draft",
"StatusCode": "Draft",
"IsDeleted": false,
"ContractNumber": "00000114",
"CreatedDate": "2022-11-15T10:03:42.000+0000",
"CreatedById": "0055g00000GRB5vAAH",
"LastModifiedDate": "2022-11-15T10:03:42.000+0000",
"LastModifiedById": "0055g00000GRB5vAAH",
"SystemModstamp": "2022-11-15T10:03:42.000+0000",
"LastViewedDate": "2022-11-15T10:03:42.000+0000",
"LastReferencedDate": "2022-11-15T10:03:42.000+0000"
},
{
"BillingStreet": "西新宿1丁目",
"BillingCity": "新宿区",
"BillingState": "東京都",
"BillingPostalCode": "163-0590",
"BillingCountry": "日本",
"BillingAddress": {
"city": "新宿区",
"country": "日本",
"geocodeAccuracy": null,
"latitude": null,
"longitude": null,
"postalCode": "163-0590",
"state": "東京都",
"street": "西新宿1丁目"
},
"ShippingStreet": "西新宿1丁目",
"ShippingCity": "新宿区",
"ShippingState": "東京都",
"ShippingPostalCode": "163-0590",
"ShippingCountry": "日本",
"ShippingAddress": {
"city": "新宿区",
"country": "日本",
"geocodeAccuracy": null,
"latitude": null,
"longitude": null,
"postalCode": "163-0590",
"state": "東京都",
"street": "西新宿1丁目"
},
.....
}
]
https://developer.salesforce.com/docs/atlas.en-us.238.0.object_reference.meta/object_reference/compound_fields_address.htm
Standard address compound fields are read-only, and are only
accessible using the SOAP and REST APIs. See Compound Field
Considerations and Limitations for additional details of the
restrictions this imposes.
Instead set single fields inside the address.
cont.ShippingCountry = 'Japan';
cont.ShippingCity = 'Tokyo';
insert cont;
Related
I have started to use this library and hit an issue.
Basically i have the following object structure which i receive from an api request.
{
"introduction": "hello",
"imageUri": "someimage.jpg",
"sections": [
{
"subSections": [
{
"sectionMedia": [
{
"externalUri": "https://vimeo.com/1212",
"id": 17127,
"type": "video",
"name": null,
"description": null,
"displayOrder": null,
}
],
"id": 172,
"name": "Section 1",
"displayOrder": 1,
},
{
"sectionMedia": [
{
"externalUri": "https://vimeo.com/1212",
"id": 178121,
"type": "video",
"name": null,
"description": null,
"displayOrder": null
}
],
"id": 178121,
"name": "Section 2",
"displayOrder": 2
},
],
"sectionMedia": [
{
"externalUri": "external.jpg",
"id": 176,
"type": "download",
"name": "Bar Modelling - Series 1 Workbook",
"description": null,
"displayOrder": null,
"createdAt": "2020-06-08T05:13:25+00:00",
"createdByUser": "/users/109",
"updatedAt": "2020-07-16T23:08:29+00:00",
"updatedByUser": "/users/109"
}
],
"id": 17111,
"name": "Series",
"description": "some description",
"displayOrder": 1,
]
}
So once the user has edited the data and this may not be all fields i need to submit and merge it with the object that we received and post full object back to the server.
However if i edit something within the array i need to show as the array name such as e.g if i updated the externalUri in sectionMedia with id 176 it should have the correct object structure when submitting the structure is flat like so:
name: "some name" externalUri: "newimage.jpg"
So wanted to see if there is a nice way to do this without actually searching the object and replacing when doing an onblur as will affect performance
Hope this makes sense
Not sure whether this is what you want but we can loop through the object
const [ fields, setFields ] = useState(
{
"externalUri": "external.jpg",
"id": 176,
"type": "download",
"name": "Bar Modelling - Series 1 Workbook",
"description": null,
"displayOrder": null,
"createdAt": "2020-06-08T05:13:25+00:00",
"createdByUser": "/users/109",
"updatedAt": "2020-07-16T23:08:29+00:00",
"updatedByUser": "/users/109"
})
We render the inputs here.
return Object.keys(fields).map( item => <input name={item} value={fields[item]} onChange={onChange} />
Then for the onchange.. we use the input name and add it back to the object.
const onChange = (e) => {
const value = e.target.value
const name = e.target.name
setFields( prev => ({ ...fields, [name]: value})) //this retains the original object, but change only the edited field
}
THOUGH.. submitting back the entire document back to the server is probably bad practice.
You should probably only submit fields that were changed.
WHY?
Because we cannot trust anything submitted from client, if you merge and resubmit the entire document, you need to make sure you re-validate the ENTIRE document.
From this link:
https://developer.deutschebahn.com/store/apis/info?name=Fahrplan-Free&version=v1&provider=DBOpenData#!/default/get_departureBoard_id
I can successfully call the ARRIVALboard information:
[
{
"name": "ICE 1689",
"type": "ICE",
"boardId": null,
"stopId": 8000152,
"stopName": "Hannover Hbf",
"dateTime": "2021-01-19T00:00",
"origin": "Hamburg-Altona",
"track": "8",
"detailsId": "78642%2F27599%2F82706%2F15139%2F80%3fstation_evaId%3D8000152"
}
, which is complete.
However, when I call the DEPARTUREboard information I get everything apart from the 'destination' JSON field.
{
"name": "ICE 272",
"type": "ICE",
"boardId": null,
"stopId": 8000152,
"stopName": "Hannover Hbf",
"dateTime": "2021-01-19T00:05",
"track": "7",
"detailsId": "972312%2F330581%2F159824%2F244192%2F80%3fstation_evaId%3D8000152"
}
, i.e., the 'destination' field is missing according to the Model schema
I guess this is a user error but I can't work out how to fix this!
I practice to use json-rpc to create test case, and I want to assoicate a test paln with test case, but I don't know the parameter of the plan.
Can anyone give me some suggestions?? Thanks.
My example like this
Test plan ID : 3
Test plan name: test
Using postman request
{
"jsonrpc":"2.0",
"method":"TestCase.create",
"params":{"values":{"summary":"jsonrpctest","case_status":2,"category":2,"priority":1,"text":"20201005test","plan":[3,"test"]}},
"id":1
}
Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"id": 191,
"create_date": "2020-10-06 04:44:13",
"is_automated": false,
"script": "",
"arguments": "",
"extra_link": null,
"summary": "jsonrpctest",
"requirement": null,
"notes": "",
"text": "20201005test",
"case_status_id": 2,
"case_status": "CONFIRMED",
"category_id": 2,
"category": "--default--",
"priority_id": 1,
"priority": "P1",
"author_id": 1,
"author": "ardyn",
"default_tester_id": null,
"default_tester": null,
"reviewer_id": null,
"reviewer": null,
"plan": [],
"component": [],
"tag": []
}
}
https://kiwitcms.readthedocs.io/en/latest/api/index.html says
"Server side RPC methods are documented in tcms.rpc.api."
Which is
https://kiwitcms.readthedocs.io/en/latest/modules/tcms.rpc.api.html
And there is the TestPlan.add_case() method:
https://kiwitcms.readthedocs.io/en/latest/modules/tcms.rpc.api.testplan.html#tcms.rpc.api.testplan.add_case
Does HERE have data on property parcel boundaries?
I am looking for the coordinates of individual properties to overlay their maps.
Unfortunately we do not have this kind of data available. Maybe this might be interesting for you:
Within the Reverse Geocode you can Request the shape of a postal district for a given latitude and longitude
This example retrieves the shape and details of the first address around a specified location in Chicago (41.8839,-87.6389) using a 150 meter radius to retrieve the address. The expected address is: 425 W Randolph St, Chicago, IL 60606, United States.
The addition of the additionaldata=IncludeShapeLevel,postalCode parameter ensures that the shape of the postal district is also included in the response. Reverse geocoding requests can be made using the reversegeocode endpoint and adding the prox parameter to the request URL. The number of results returned can be restricted using the maxresults parameter.
https://reverse.geocoder.ls.hereapi.com/6.2/reversegeocode.json?prox=41.8839%2C-87.6389%2C150&mode=retrieveAddresses&maxresults=1&additionaldata=IncludeShapeLevel%2CpostalCode&gen=9&apiKey=xxx
{
"Response": {
"MetaInfo": {
"Timestamp": "2020-07-27T09:56:24.943+0000",
"NextPageInformation": "2"
},
"View": [
{
"_type": "SearchResultsViewType",
"ViewId": 0,
"Result": [
{
"Relevance": 1,
"Distance": 16.3,
"MatchLevel": "houseNumber",
"MatchQuality": {
"Country": 1,
"State": 1,
"County": 1,
"City": 1,
"District": 1,
"Street": [
1
],
"HouseNumber": 1,
"PostalCode": 1
},
"MatchType": "pointAddress",
"Location": {
"LocationId": "NT_puy2gbuVuGd-an6zGdSyNA_xADM",
"LocationType": "address",
"DisplayPosition": {
"Latitude": 41.88403,
"Longitude": -87.63881
},
"NavigationPosition": [
{
"Latitude": 41.88401,
"Longitude": -87.63845
}
],
"MapView": {
"TopLeft": {
"Latitude": 41.8851542,
"Longitude": -87.6403199
},
"BottomRight": {
"Latitude": 41.8829058,
"Longitude": -87.6373001
}
},
"Address": {
"Label": "100 N Riverside Plz, Chicago, IL 60606, United States",
"Country": "USA",
"State": "IL",
"County": "Cook",
"City": "Chicago",
"District": "West Loop",
"Street": "N Riverside Plz",
"HouseNumber": "100",
"PostalCode": "60606",
"AdditionalData": [
{
"value": "United States",
"key": "CountryName"
},
{
"value": "Illinois",
"key": "StateName"
},
{
"value": "Cook",
"key": "CountyName"
},
{
"value": "N",
"key": "PostalCodeType"
}
]
},
"MapReference": {
"ReferenceId": "1190062166",
"MapId": "NAAM20117",
"MapVersion": "Q1/2020",
"MapReleaseDate": "2020-06-29",
"Spot": 0.59,
"SideOfStreet": "left",
"CountryId": "21000001",
"StateId": "21002247",
"CountyId": "21002623",
"CityId": "21002647",
"BuildingId": "9000000000002726912",
"AddressId": "79186499",
"RoadLinkId": "499349060"
},
"Shape": {
"_type": "WKTShapeType",
"Value": "MULTIPOLYGON (((-87.6339 41.88446, -87.6338 41.8813, -87.63239 41.88132, -87.63238 41.88067, -87.63378 41.88068, -87.63376 41.8794, -87.63377 41.87812, -87.6352 41.87811, -87.6352 41.87682, -87.63665 41.87678, -87.63663 41.87666, -87.63664 41.87658, -87.6367 41.87664, -87.63674 41.87678, -87.63706 41.87677, -87.6374 41.87807, -87.63756 41.87861, -87.63774 41.87936, -87.63794 41.88062, -87.63791 41.8819, -87.63779 41.88322, -87.63764 41.88449, -87.63727 41.88574, -87.63739 41.88602, -87.63603 41.88695, -87.63559 41.88717, -87.63248 41.8871, -87.63248 41.88703, -87.63374 41.88703, -87.63386 41.887, -87.63395 41.88702, -87.6339 41.88446)), ((-87.64102 41.87676, -87.64104 41.87804, -87.63955 41.87805, -87.63959 41.87933, -87.63966 41.88058, -87.63969 41.88187, -87.63976 41.88318, -87.6398 41.88446, -87.64022 41.88445, -87.64022 41.8846, -87.64025 41.88479, -87.64035 41.8851, -87.64047 41.88571, -87.63981 41.88572, -87.64062 41.88625, -87.64063 41.88639, -87.64064 41.88678, -87.63989 41.88679, -87.63993 41.88758, -87.6401 41.88769, -87.64035 41.88782, -87.64054 41.8879, -87.6407 41.88793, -87.64076 41.88828, -87.64085 41.88859, -87.63996 41.88847, -87.63999 41.88906, -87.63971 41.88905, -87.63961 41.88882, -87.63954 41.8887, -87.63918 41.88675, -87.63873 41.8864, -87.63841 41.88588, -87.6383 41.88573, -87.63812 41.88522, -87.63825 41.88449, -87.63845 41.88321, -87.63855 41.88231, -87.63858 41.88104, -87.63855 41.88061, -87.63836 41.87935, -87.63787 41.87794, -87.63778 41.87751, -87.63752 41.87751, -87.63752 41.87731, -87.63775 41.87728, -87.6377 41.87687, -87.63784 41.87684, -87.63778 41.87676, -87.64102 41.87676)))"
}
}
}
]
}
]
}
}
See also https://developer.here.com/blog/how-to-get-the-shape-of-an-area-using-the-here-geocoder-api
I am submitting a form for job posting and have skills like C# which escape in my rest API. So I encoded the skills and sending to backend.
"skills":encodeURIComponent(skills)
now when I get back the skills I am doing decodeURIComponent for my skills
$scope.skills = decodeURIComponent(skills);
but this wont work with array of datas, when I want to fetch list of jobs , the datas comes in array , my array has almost 15 key values , which will be used in table some way. Writing a new array and pushing each values into array again pushing decoded skills a big process.
Is any solution to directly decoded the value in view , that is html
I tried {{decodeURIComponent(item.skills) }} but no luck.
sample Data ::
{
"json": {
"response": {
"statusmessage": "Success",
"count": 59,
"data": [
{
"employerId": 2,
"employerEmail": "sumit#infosoftjoin.in",
"employerName": "SumitKumar",
"companyName": "Infosoftjoin%20pvt%20ltd.",
"jobId": 142,
"jobTitle": "Test%20case%201",
"jobDescription": "<p>ahdu%29%28#*%29*W%29%28*%29E%26%3D--%3D</p>",
"link": "http://www.infosoftjoin.in",
"numberOfPositions": 5,
"createdTime": "18-May-2018",
"lastUpdatedTime": "18-May-2018",
"consumedCredits": 44,
"location": {
"city": "North And Middle Andaman",
"state": "Andaman and Nicobar Islands",
"country": "India"
},
"skills": [
"C%23.NET"
],
"approved": 1,
"status": "Approved"
},
{
"employerId": 2,
"employerEmail": "sumit#infosoftjoin.in",
"employerName": "SumitKumar",
"companyName": "Infosoftjoin%20pvt%20ltd.",
"jobId": 130,
"jobTitle": "New%20job",
"jobDescription": "hryuyurfkituo8",
"link": "http://www.infosoftjoin.in",
"numberOfPositions": 5,
"createdTime": "16-May-2018",
"lastUpdatedTime": "16-May-2018",
"consumedCredits": 93,
"location": {
"city": "Nicobar",
"state": "Andaman and Nicobar Islands",
"country": "India"
},
"skills": [
"APACHE TOMCAT"
],
"approved": 1,
"status": "Approved"
}
]
}
}
}
encodeURIComponent is a JavaScript built-in function, you can not access it directly in your AngularJs template. Convert that into a $scope function then try accessing from AngularJs template.
I would suggest you to have a filter for the same instead of $scope function.
Filter:
app.filter('decodeFilter', function() {
return function(input) {
return decodeURIComponent(input);
};
});
Template:
{{item.skills | decodeFilter}}
If still you want that as $scope function then try below code:
Controller:
$scope.decodeComponent=function(value){
return decodeURIComponent(value);
}
Template:
{{decodeComponent(item.skills)}}
Also, please check this plunker for sample scenario with the above examples.