I'm trying to create Location record in test class in OMS. but getting following error when trying to assign value to Name- 'Variable does not exist: Name'
code -
Location loc = new Location();
loc.Name = 'XYZ';
insert loc;
I tried by creating record with Syatem.Location. getting this error - 'Variable is not visible: System.Location.longitude'
code -
System.Location loc = new System.Location();
loc.Longitude = '28.635308';
loc.Latitude = '28.635308';
insert loc;
If I create record instance using Location fulfillLoc = Location.newInstance(28.635308,77.22496); it works but how can I get Id of this Location, is it really possible? and also there are no fiel Name on this System object. I don't think this is the right approach.
Thanks,
Mayur
You can use Schema.Location. Try below code.
Schema.Location loc = new Schema.Location();
loc.Longitude = '28.635308';
loc.Latitude = '28.635308';
insert loc;