Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Update the field

Ajeet
Contributor III

I created an custom object in contract application. it saves the selected answers first and then generate the engagement record and copies the selected values to engagement. the custom object is working fine however some requirement is updated and after generating the engagement the page should be styed on contract application and there is a flag as a values list which must be updated to Yes.  i am having some doubt about the update part how we can add the update operation using levelID and record ID? sharing the code:  The engagement function using the Archer create API and creating the engagement record, how we can add update operation here to update the flag field?

@Anonymous  @Ilya.Khen @Ilya_Khen @JeffLetterman @archer_scripts 

function Engagement() {

        $CFS.LOG.info('Creating Engagement');

        var deferred = $.Deferred();
        var lvlId = $CFS.CONTENT.LEVEL_CACHE[LVL.Engagements.alias].Id;
        var lvlIdCon = $CFS.CONTENT.LEVEL_CACHE[APP.Contract.alias].Id;
        var ContractId = $CFS.RECORD_ID;
        var content = {
            LevelId: lvlId
        };

        var contentCon = {
            ID: ContractId,
            LevelId: lvlIdCon
        };

        $CFS.CONTENT.setLevelFieldValue(LVL.Engagements.Contract_To_Engagement.Id, [$CFS.RECORD_ID], content, lvlId);

        var contract = $CFS.CONTENT.getFieldValue(APP.Contract.ID);
        var scopeOne = $CFS.CONTENT.getFieldValue(APP.Contract.Initial_Scoping_1);
        var scopeTwo = $CFS.CONTENT.getFieldValue(APP.Contract.Initial_Scoping_2)
        $CFS.CONTENT.setLevelFieldValue(LVL.Engagements.Initial_Scoping_1, scopeOne.Value, content, lvlId);
        $CFS.CONTENT.setLevelFieldValue(LVL.Engagements.Initial_Scoping_2, scopeTwo.Value, content, lvlId);
        $CFS.CONTENT.setLevelFieldValue(LVL.Engagements.Engagement_Name, contract.Value, content, lvlId);
        $CFS.LOG.info('New Engagement request', content);
        $CFS.API.createRecord(content).then(function (newRecord) {
            $CFS.LOG.info('New Engagement response', newRecord);
            deferred.resolve(newRecord.Id);
            sessionStorage.removeItem("key");
        }).fail(deferred.reject);

        return deferred.promise();
    }
1 REPLY 1

DavidPetty
Archer Employee
Archer Employee

@Ajeet can't you set the flag first before creating the engagement record?

 Advisory Consultant