1

I am working to integrate SFDC with a Field Service Management/Scheduling solution and we have integrated custom "on-site forms" to capture information while a technician is on-site (imagine a field technician filling out a form detailing what happened during the job).

These forms have been integrated and mapped to a custom object named "Execution Forms" in SFDC. In order to do this, I have created custom fields & relationships to map to all of the possible properties/fields on the "on-site forms". However, one of our customers has several forms and currently all of their properties are mapped in the same page layout and only the fields which are relevant to that form are mapped while the rest are left blank. They may have 100 different properties on 10 different forms, but the first form may only have 10 properties. When viewing in SFDC, they wish to only see the 10 custom fields rather than all 100 with a majority of them being blank.

Is it possible to create unique page layouts (or via another method) to only display the fields which are populated per "on-site form"?

1

Record Types

One way you would be able to do this is using RecordTypes with Page Layouts.

What you would need to do is some "preprocessing" that determines if the form filled in is an "on-site form".

For example, if you have 6 fields: a, b, c, x, y, z; in your preprocessing you can check if only x, y and z are filled in. On Insert, you would then set the RecordType of the record.

For example:

Object__c obj = new Object__c(
  a_field__c = a;
  a_field__c = b;
  a_field__c = c;
  x_field__c = x;
  y_field__c = y;
  z_field__c = z;
);

if (a == null && b == null && c == null) {
    obj.RecordTypeId = [SELECT Id FROM RecordType WHERE Name = 'On Site Record Type' AND SObjectType = 'Object__c' LIMIT 1].Id;
}

INSERT obj;

Once this is done and you access the record in Salesforce, the Page Layout associated with the RecordType.

You would need to create the RecordType first, then the Page Layout. You'll eventually get prompted to Associate the Page Layout with a RecordType.

Provided you don't have too many variations, this would be a good way of achieving your requirement.

Visualforce

You could of course, create a custom Visualforce Page that only rendered fields if the field isn't null. That could also work:

<apex:inputField value="{!a}" rendered="{!NOT(ISNULL(a))}" />
<apex:inputField value="{!b}" rendered="{!NOT(ISNULL(b))}" />
<apex:inputField value="{!c}" rendered="{!NOT(ISNULL(c))}" />
[...]
| improve this answer | |

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.