1

Add.js

$scope.addEntity = function (entity, $event) {

            entity.dateString = $("#dpFrom").val();
            entity.ExpDateString = $("#dpTo").val();
            if (entity && entity.project && entity.equipment && entity.eqptagno && entity.wono && entity.processlicensor && entity.Vendor && entity.dateString && entity.ExpDateString && entity.Discipline && entity.Remarks) {
                if (entity.dateString < entity.ExpDateString) {
                    spService.addNew(entity)
                    .then(function (response) {
                        $location.path("/");
                    });
                    //$event.preventDefault();
                    $scope.FormActionMessage = "ERF Forwarded to Project Manager. Please check Requester Dashboard for the update!";
                    // $window.alert("ERF Forwarded to Project Manager. Please check Requester Dashboard for the update!");
                    // clearForm();
                    $scope.IsVisible = false;
                    event.preventDefault ? event.preventDefault() : event.returnValue = false;

                } else {
                    //$window.alert("ERF Not Submitted!... Expected Date of Demobilisation should be greater than Date of Requirement!");
                    $scope.FormActionMessage("ERF Not Submitted!... Expected Date of Demobilisation should be greater than Date of Requirement!");
                    event.preventDefault ? event.preventDefault() : event.returnValue = false;
                }
            }
            else {
                return false;
            }
        };

Entity.js

var addNew = function (entity) {
        var data = {
            __metadata: { 'type': 'SP.Data.ERFListItem' },
            Project: entity.project,
            Equipment_Category: entity.equipment,
            Equipment_Tag_Number: entity.eqptagno,
            PO_Number_For_Vendor_Expat: entity.wono,
            Licensor_Name: entity.processlicensor,
            Vendor: entity.Vendor,
            Date_Of_Requirement: entity.dateString,
            Expected_Date_Of_Demobilisation: entity.ExpDateString,
            Discipline: entity.Discipline,
            Remarks: entity.Remarks,
            Sub_Flag: "F",
            Action_Flag: "FM",
            ERF_Status: "Requester Forwarded ERF To PM",
            ERF_Created_By: entity.currentUser
        };
        var url = listEndPoint + "/GetByTitle('ERF')/Items";
        return baseService.postRequest(data, url);
    };
2

SharePoint people or group column requires user's or group's Id to save into it.

You can get current user's Id from _spPageContextInfo

var userId = _spPageContextInfo.userId;

Now let's say your people or group column name is Vendor. So in the request body it should look like:

var data = {
   VendorId: userId
};

More details is here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.