• Alexander Vishtak
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

User-added image

Is it possible to add matching fields for lookup & master-detail relationships in the Import Wizard?

I have a field X in the product object. And it is much simplier for to import data using this field. But there is no field X in this list.

Looking forward if someone can help me.
Best Wishes
Alex

I have two custom objects: x__c and y__c.  i have multiple records in y__c object. This object is displaying as a related list on x__c object.

I want to create a button which will take records from y__c object and SHOW them on x__c object related list. This button should not create any records. Just showing already existing information. Any help will be appreaciated.
The code below: the button opens a lookup search but after i pick a record it just refreshes the page, not adding any recotrds into related list.

Thank You

Alex

 

public with sharing class AssociateVehicleExtController {

    public ECS__eCommSource_Order__c order  { get; set; }
    
    public AssociateVehicleExtController() {
        
        String orderId = ApexPages.currentPage().getParameters().get('id');
        order = [SELECT Id, Name, Vehicle1__c FROM ECS__eCommSource_Order__c WHERE Id =: orderId];
        
    }
    
    public PageReference associate () {
        
        Vehicle__c vec = new Vehicle__c (Id = order.Vehicle1__c, name = order.Id);
        
        try {
        	Database.update(vec);
        } catch (Exception error) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while associating.' + error.getMessage()));
        }
        
        PageReference page = new PageReference('/' + order.Id);
        
        return page.setRedirect(true);
    }
    
    public PageReference cancel () {
        PageReference page = new PageReference('/' + order.Id);
        return page.setRedirect(true);        
    }
    
}
<apex:page controller="AssociateVehicleExtController">
    <apex:form>
        <apex:pageblock title="Associate Vehicle to Custom Object">
            <apex:pageMessages />
            <apex:pageblockbuttons location="top">
                <apex:commandbutton value="Associate" action="{!associate}" />
                <apex:commandbutton value="Cancel" action="{!cancel}"/>
            </apex:pageblockbuttons>
            <apex:pageBlockSection>
                <apex:pageBlockSectionItem>
                    <apex:outputLabel>Order Name</apex:outputLabel>
                    <apex:outputText>{!order.Name}</apex:outputText>   
                </apex:pageBlockSectionItem>
              <apex:pageBlockSectionItem>
                    <apex:outputLabel>Vehicle</apex:outputLabel>
                    <apex:inputField value="{!order.Vehicle1__c}"/>
                </apex:pageBlockSectionItem>                
            </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
</apex:page>

 
The scenario is as follows. On an Opportunity, I have a lookup to a custom object. The corresponding related list on the custom object has a 'New' button to create new Opportunities from the custom object. Users want to click a button on the related list that displays a screen to select an existing Opportunity and associate a selected Opportunity to the related list on the custom object.