Lookup dependent updatable ? on SP form designed

Hello everyone,

I'm asking if my developpement could be faisable, on my SP form designed.

I've got a "PR" SP list with 2 infos :

  • name of the supplier, lookup column from "Supplier" list with supplier name which is selectionnable in a drop down list into my form
  • the "contact" field, lookup dependent from "Supplier" list and thus dependent on supplier name above

So, my wishes are :

  • I would like to show the "contact" dependent result when selectionning a supplier
  • then, if this contact field is empty, make it updable by the person filling in the form

I wouldn't like to create an other contact column here. But if it's not faisable, I will :slight_smile:

Thanks again,

Hi @lolopixxx,

This should be fairly simple to achieve. Since both fields are on the same list, you can just assign the ID from the Supplier lookup to the contact lookup: Lookup field — Plumsail SharePoint Forms Documentation

Let me know if you have any further questions.

Hello [IliaLazarevskii] ! thanks for your reply.

Let assume I've got this below

fd.spRendered(function(){

// returns an ID of the selected option:
//fd.field('My supplier contact field').value.LookupId;


});

hum, so what should I do after having my ID? :slight_smile:

Hi @lolopixxx,

Assign the ID to the second lookup whenever Supplier is changed. Since they reference the same SharePoint list, they will fetch data for the same item:

fd.spRendered(function(){
    fd.field('My supplier contact field').$on('change', () => {
        fd.field('Contact field').value = fd.field('My supplier contact field').value.LookupId;
    });
});

Hi [IliaLazarevskii] ,

Yes, references are on the same SP list.
My supplier contact field = email of the supplier, so depending on my Supplier namefield value
Contact field ? what we are talking about here ^^'

(yes, I'm a "pretty" mess in plumsail sorry.)

Hi @lolopixxx,

To change Supplier contact according to Supplier name, create a lookup field for each value and use this code:

fd.spRendered(function(){
    fd.field('SupplierName').$on('change', () => {
        fd.field('SupplierContact').value = fd.field('SupplierName').value.LookupId;
    });
});

Hello [IliaLazarevskii] !

I've created 1 extra lookup column and routing it on my existing one with those parameters below :slight_smile:

It show the contact depending to this supplier.

Then, I'm asking if I can set an "add new" option and customize the corresponding form. Cause with the actual "add new" form by default, you have the chance to change every SP field, that I totally don't want to.

So, do an user can change only "supplier contact" whan not existing ? I saw this : Different Form Set on Add New Item - Forms - Plumsail Community

But I'm asking is I can create a new form posted into "all users" group, dont' know if it's possible here cause NEW EDIT and DISPLAY already exist.

Hi @lolopixxx,

Try checking if the form is opened in a dialog and disabling the sensitive fields if it is:

fd.spRendered(function() {
    if (fd.isDialog) {
        fd.field('fieldName').disabled = true;
    }
});
1 Like

Hello IliaLazarevskii and thank you, i'll take it

1 Like