• Sathyapriya V
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hi, I'm trying to change the below formula field to open in both console and standard page.currently if I click the link from console it is opening outside of the console. I want this to open within the console.

Existing formula which is working:
HYPERLINK("/500/e?RecordType=012F0000000yFNi&cas4="
& Owner__r.FirstName & "%20" & Owner__r.LastName & "&cas4_lkid=" & Owner__r.Id & "&cas8=N/A" 
& "&CF00NA00000070W35=" & Vehicle__r.Name & "&CF00NA00000070W35_lkid=" & Vehicle__r.Id 
&"&CF00NF0000008ODHT=" & Owner__r.Servicing_Dealer__r.Name & "&CF00NF0000008ODHT_lkid=" 
&Owner__r.Servicing_Dealer__r.Id & "&00NF0000008NeI5=" & Vehicle_Make__c 
& "&00NF0000008NeKU=" &TEXT(Owner__r.Vehicles_Owned__c) , "New VCS Case with Vehicle" )

Modified one 
HYPERLINK("javascript:if(typeof(srcUp)=='function') {srcSelf('/500/e?RecordType=012F0000000yFNi&cas4=" & Owner__r.FirstName & '%20' & Owner__r.LastName & '&cas4_lkid=' & Owner__r.Id & '&cas8=N/A' 
& '&CF00NA00000070W35=' & Vehicle__r.Name & '&CF00NA00000070W35_lkid=' & Vehicle__r.Id 
&'&CF00NF0000008ODHT=' & Owner__r.Servicing_Dealer__r.Name & '&CF00NF0000008ODHT_lkid=' 
&Owner__r.Servicing_Dealer__r.Id & '&00NF0000008NeI5=' & Vehicle_Make__c 
& '&00NF0000008NeKU=' &TEXT(Owner__r.Vehicles_Owned__c) "');} "+ " else {window.location.href='/" & Id & "'}" 
,"New VCS Case with Vehicle" 
, "_Parent" ) 

But I'm getting syntax error with the above one. can Someone please help me on this.
I followed below format.
HYPERLINK("javascript:if(typeof(srcUp)=='function') {srcUp('/" & Id &"');}" + " else {window.open('/"& Id &"')}", "View Member in Console", "_blank" )

Thanks.
I need an Urgent help to investigate on the SendGrid functionality of Heroku. As I'm new to this  I would like to understand the implementation process of it.Kindly share any document if it is there related this. 
 
I need an Urgent help to investigate on the SendGrid functionality of Heroku. As I'm new to this  I would like to understand the implementation process of it.Kindly share any document if it is there related this. 
 
Error : 
User-added image

I have overridden the add and new standard buttons as well.
User-added image
Product2Extension.cls :
public class Product2Extension {

  public List<ProductWrapper> productsToInsert {get; set;}

  public Product2Extension(ApexPages.StandardController controller){
    productsToInsert = new List<ProductWrapper>();
    AddRows();
  }

  public void AddRows(){
    for (Integer i=0; i<Constants.DEFAULT_ROWS; i++ ) {
      productsToInsert.add( new ProductWrapper() );
    }
  }

  public List<ChartHelper.ChartData> GetInventory(){
    return ChartHelper.GetInventory();
  }

  public List<SelectOption> GetFamilyOptions() {
    List<SelectOption> options = new List<SelectOption>();
    options.add(new SelectOption(Constants.SELECT_ONE, Constants.SELECT_ONE));
    for(PickListEntry eachPicklistValue : Constants.PRODUCT_FAMILY) {
      options.add(new SelectOption(eachPicklistValue.getValue(), eachPicklistValue.getLabel()));
    }
    return options;
  }

  public PageReference Save(){
    Savepoint sp = Database.setSavepoint();
    try {
      List<Product2> products = new List<Product2>();
      List<PricebookEntry> pbes = new List<PricebookEntry>();

      for (ProductWrapper prodwrapper : productsToInsert) {
        if(prodwrapper.productRecord != null && prodwrapper.pricebookEntryRecord != null) {
          if(prodwrapper.productRecord.Name != null && prodwrapper.productRecord.Family != null && constants.SELECT_ONE != prodwrapper.productRecord.Family && prodwrapper.productRecord.Initial_Inventory__c != null && prodwrapper.pricebookEntryRecord.UnitPrice != null) {
            products.add(prodwrapper.productRecord);
            PricebookEntry pbe = prodwrapper.pricebookEntryRecord;
            pbe.IsActive = true;
            pbe.Pricebook2Id = Constants.STANDARD_PRICEBOOK_ID;
            pbes.add(pbe);
          }
        }
      }

      insert products;

      for (integer i = 0; i < pbes.size(); i++) {
        pbes[i].Product2Id = products[i].Id;
      }
      insert pbes;

      //If successful clear the list and display an informational message
      apexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO,productsToInsert.size()+' Inserted'));
      productsToInsert.clear();         //Do not remove
      AddRows();        //Do not remove
    } catch (Exception e){
      Database.rollback(sp);
      apexPages.addMessage(new ApexPages.message(ApexPages.Severity.ERROR, Constants.ERROR_MESSAGE));
    }
    return null;
  }

  public class ProductWrapper {
    public Product2 productRecord {get; set;}
    public PriceBookEntry pricebookEntryRecord {get; set;}

    public ProductWrapper() {
      productRecord = new product2(Initial_Inventory__c =0);
      pricebookEntryRecord = new pricebookEntry(Unitprice=0.0);
    }
  }
}
Product2New​.page :
<apex:page standardcontroller="Product2" extensions="Product2Extension">
  <apex:sectionHeader title="New Product" subtitle="Add Inventory"/>
  <apex:pageMessages id="pageMessages"/>
  <apex:form id="form">
    <apex:actionRegion>
      <apex:pageBlock title="Existing Inventory" id="existingInv">
        <apex:chart data="{!Inventory}" width="600" height="400">
          <apex:axis type="Category" fields="name" position="left" title="Product Family"/>
          <apex:axis type="Numeric" fields="val" position="bottom" title="Quantity Remaining"/>
          <apex:barSeries axis="bottom" orientation="horizontal" xField="val" yField="name"/>
        </apex:chart>
      </apex:pageBlock>
      <apex:pageBlock title="New Products">
        <apex:pageBlockButtons location="top">
          <apex:commandButton action="{!save}" value="Save" reRender="existingInv, orderItemTable, pageMessages"/>
        </apex:pageBlockButtons>
        <apex:pageBlockButtons location="bottom">
          <apex:commandButton action="{!addRows}" value="Add" reRender="orderItemTable, pageMessages"/>
        </apex:pageBlockButtons>

        <apex:pageBlockTable value="{!productsToInsert}" var="p" id="orderItemTable">
          <apex:column headerValue="{!$ObjectType.Product2.Fields.Name.Label}">
            <apex:inputText value="{!p.productRecord.Name}"/>
          </apex:column>
          <apex:column headerValue="{!$ObjectType.Product2.Fields.Family.Label}">
            <apex:selectList value="{!p.productRecord.Family}" size="1" multiselect="false">
              <apex:selectOptions value="{!FamilyOptions}"></apex:selectOptions>
            </apex:selectList>
          </apex:column>
          <apex:column headerValue="{!$ObjectType.Product2.Fields.IsActive.Label}">
            <apex:inputField value="{!p.productRecord.isActive}"/>
          </apex:column>
          <apex:column headerValue="{!$ObjectType.PricebookEntry.Fields.UnitPrice.Label}">
            <apex:inputText value="{!p.pricebookEntryRecord.UnitPrice}"/>
          </apex:column>
          <apex:column headerValue="{!$ObjectType.Product2.Fields.Initial_Inventory__c.Label}">
            <apex:inputField value="{!p.productRecord.Initial_Inventory__c}"/>
          </apex:column>
        </apex:pageBlockTable>
      </apex:pageBlock>
    </apex:actionRegion>
  </apex:form>
</apex:page>
product2Trigger : 
trigger product2Trigger on Product2 (after update) {
  Product2Helper.AfterUpdate((List<Product2>)Trigger.new);
}
Constants.cls : 
public class Constants {
  public static final Integer DEFAULT_ROWS = 5;
  public static final String SELECT_ONE = Label.Select_One;
  public static final String INVENTORY_LEVEL_LOW = Label.Inventory_Level_Low;
  public static final List<Schema.PicklistEntry> PRODUCT_FAMILY = Product2.Family.getDescribe().getPicklistValues();
  public static final String DRAFT_ORDER_STATUS = 'Draft';
  public static final String ACTIVATED_ORDER_STATUS = 'Activated';
  public static final String INVENTORY_ANNOUNCEMENTS = 'Inventory Announcements';
  public static final String ERROR_MESSAGE = 'An error has occurred, please take a screenshot with the URL and send it to IT.';
  public static final Id STANDARD_PRICEBOOK_ID = '01s6A0000031LaYQAU'; //Test.isRunningTest() ? Test.getStandardPricebookId() : [SELECT Id FROM PriceBook2 WHERE isStandard = true LIMIT 1].Id;
}
Can somebody try and paste the working code here. It would be a great help.
Thanks in advance.