JavaScript In D365:-

function createChildRecordFromParent(executionContext) {
var formContext = executionContext.getFormContext();
// Step 1: Get values from parent entity fields
var parentField1 = formContext.getAttribute(“jana_name”).getValue();
var parentField2 = formContext.getAttribute(“jana_a”).getValue();
var recordId = formContext.data.entity.getId().replace(“{“,””).replace(“}”,””);
var childRecord = {};
childRecord.jana_a = parentField2; // Whole Number
childRecord.jana_name = parentField1; // Text
childrecord[“jana_vk@odata.bind”] = “/jana_vks(” + recordId + “)” // Lookup

Xrm.WebApi.createRecord(“jana_kumar”, childRecord).then(
function success(result) {
var newId = result.id;
console.log(“Child record created successfully with ID: ” + newId);
},
function error(error) {
console.error(“Error creating child record: ” + error.message);
}
);
}

First take the new form and fill the name field And save the form 

JavaScript

then automatically creates the sub grid record

When The Sub grid Opens it will Automatically Creates the Values

For any Help or Queries Contact us on info@crmonce.com or +91 9493926112

 https://www.crmonce.com/how-to-adding-days-to-expiry-date-by-using-power-automate/