• Kate Starostina 13
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
I have a group that I am on boarding to our SF instance.  They mainly have Contact data that contains primarily 5 fields of important contact data which includes Level, Discpline, Sector, Speciality and Sub Specialty.  They use these 5 fields to set filters to run reports for email campaigns and physical samples they need to send out.  The main issue is that these fields in their system are multi-select.  I don't want to create 5 multi select fields for them because reporting would be diffficult.  Any ideas on how to get this working with the least amount of fields and avoiding multi-select?
I have a custom button on Quote/Proposal object (Apttus) that looks at the Line Items, sees if one of them has the Sample check box checked and if so, pulls that line item into a Visual Force page to place a sample order.  The code from the Quote/Propsal is pasted below.  What I am trying to do is replicate this behavior on the Opportunity Product.  I've created the same Sample_c button on the Opportunity Product object and I have added the button on the Opportunity page layout.  What I would like is that when the user clicks the button from the Opportunity that same VF page is invoked. So I need to make changes to this code, but I have no idea what I'm doing.

-->PS_CreateSampleOrder is the name of the VF page.  
-->Behavior is Execute JavaScript
-->Display type is Detail Page Button

{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/32.0/apex.js")} 

var sampleOrderPage = "/apex/PS_CreateSampleOrder?Id={!Apttus_Proposal__Proposal__c.Id}"; 

var propLineItemRecs = sforce.connection.query("SELECT Id FROM Apttus_Proposal__Proposal_Line_Item__c WHERE Apttus_Proposal__Proposal__c = '{!Apttus_Proposal__Proposal__c.Id}' AND Sample__c = true"); 

records = propLineItemRecs.getArray("records"); 

if(records.length > 0){ 
window.open(sampleOrderPage, "_self"); 

else { 
alert("{!$Label.PS_CreateSampleOrderNoSampleProdsError}");