We have a need in one of our applications to copy data from one record to another record when the status changes to close if both records share an id field value.
Example: copy the value from a date field, the value from a text field and a picklist value when the status is changed to closed from one record to another record if both records share the same value of a field named id (record_1 id = 123 and record_2 id = 123).
This can be achieved by a custom field named id because the internal field record_id is unique for all records.
We can copy the data from one record to another record by invoking a business rule having the condition, status equals to closed that executes the below class.
import com.platform.API.*;
public class CopyRecorddata
{
public void copyRecord(Parameters params) throws Exception
{
You are facing this issue because you are not changing the OBJECT NAME and field names. After creating the above class please replace the OBJECT NAME with your object name and the object should contain the fields subject, custom_id, priority and date_closed. Then it will work.
Thank you for replying. I appreciate you working with me on this.
I did replace OBJECT NAME with the name of the object I am referencing, and changed the fields subject, priority, and closed date with the fields I want to use. The object I am using is not a case object and therefore does not have the fields close date, subject or priority.
Maybe I explained what I want incorrectly:
When a new person record is added (person object), a field is created called household id. Any person with the same address shares this household id. When one of these persons needs equipment, a request is created (request is the case object). When the request is closed, the equipment (inventory object) is assigned (the way it is assigned is the household id is added the inventory record, the field is called client household id) to the person. I would like this piece of equipment to be assigned to all persons with the same household id.
All 3 objects contain lookups to each object.
Thank you for taking time to help me with this.
Added the code I am using:
package com.platform.copy.copyRecord;
import com.platform.API.*;
public class CopyRecord
{
public void copyRecord(Parameters params) throws Exception
{
only one user can be a part of the owner. If you want to assign then
1.Create the replica of the same record equal to the number of persons having same household id and assign each record to each person.
or
2. Create teams with the persons having same household id and assign the record to the respective team.