toMap
Convert the MObject to a map
MObject mo = MObject.create(new Pricebook2(Name='pricebook'));
Map data = mo.toMap(true); | Name | Description |
|---|---|
| toMap(Boolean) | Convert to map, whether to trim namespace |
| toMap() | Convert to map, keeping namespace |
Convert the MObject to a map
MObject mo = MObject.create(new Pricebook2(Name='pricebook'));
Map data = mo.toMap(true); | Name | Description |
|---|---|
| toMap(Boolean) | Convert to map, whether to trim namespace |
| toMap() | Convert to map, keeping namespace |
Get the value from MObjects
MObject mo = MObject.create(new Pricebook2(Name='pricebook'));
String name = (String)mo.get('LastModifiedBy.Name', 'Unknown');| Name | Description |
|---|---|
| get(String, Object) | Get the value of the path, returning default value if null |
| get(String) | Get the value of the path |
| get(List | Get the value of the path, returning default value if null |
| get(List | Get the value of the path |
Update the value of the MObjects
MObject mo = MObject.create(new Pricebook2(Name='pricebook'));
mo.put('LastModifiedBy.Name', 'Wilson');| Name | Description |
|---|---|
| put(String, Object) | Update the value of the path |
| put(List | Update the value of the path |
Mark the MObjects as deleted
MObject mo = MObject.create(new Pricebook2(Name='pricebook'));
mo.markDeleted(true);| Name | Description |
|---|---|
| markAsDeleted() | Mark the MObject as deleted |
| markAsDeleted(Boolean) | Mark the MObject as deleted, cascadingly |
Check if the MObject is dirty
MObject mo = MObject.create(new Pricebook2(Name='pricebook'));
Boolean dirty = mo.isDirty();Check if the MObject is marked as deleted
MObject mo = MObject.create(new Pricebook2(Name='pricebook'));
Boolean deleted = mo.isDeleted();Persist the MObject
MObject mo = MObject.create(new Pricebook2(Name='pricebook'));
mo.put('Name', 'new name');
mo.persist();
List mos = MObject.createList(new List());
for(MObject mo : mos) {
mo.put('Name', 'new name');
}
MObject.persist(mos); Contribute on Github! Edit this section.