• Aaron Persich 9
  • NEWBIE
  • 45 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 9
    Replies
Hello,

I am fairly junior to Apex and I am tgrying to build a random number.  I found this Apex code online and saved it successfully in my Sandbox.  
public with sharing class RandomNumberGenerator {
    public static String generateRandomNumber() {
        String randomNumber = generate();
        if (randomNumber.length() < 6) {
            String randomNumber2 = generate();
            randomNumber = randomNumber + randomNumber2.substring(0, 10 - randomNumber.length());
        }
        return randomNumber;
    }
    public static String generateIdentifier(String prefix) {
        return prefix + '-' + generateRandomNumber();
    }
    private static String generate() {
        return String.valueOf(Math.abs(Crypto.getRandomInteger()));
    }
}
I have a number field labeled BIOS_Password__c on the asset object.  How do I get this Apex class to populate this field on creation of the asset?  Any help is much appreciated.

Thanks,

Aaron
 
Hello,
 
As part of fulfillment process our manufacturing team works on Assets which are related to the standard Order object.  The manufacturing team needs to add either a Serial Number or a Voucher Code (text fields) to the related assets before they can complete their fulfillment.  This is an important step and is easily missed. 
 
What I would like to do is create a Ready For Fulfillment – picklist field on the Order which will query on all related assets. 

1)  If any or all asset do NOT have either a Serial Number or a Voucher Code then I would like the Ready For Fulfillment field to be set to "Not Ready". 

2)  If all Assets have at least one Serial Number or a Voucher Code then I would like the Ready For Fulfillment field to be set to "Ready".
 
Can I do this using a Flow, Process Builder or Trigger?
 
Thanks,

Aaron
Hello,
 
I have created a Generate Order/Contract button on the opportunity which when selected it will create the Order, Order Products, Contract, and Assets.  This works fine but management would like to only create Assets if the Opportunity Products have a Product Type as software.  We sell both Hardware and software products and the flow should only create the Software Assets.
 
I have tried to add a decision element after the loop through the Opportunity products when I test no Asset being created.  I am not sure what I am missing.

User-added image
User-added image

User-added image

User-added image

Any help is much appreciated.

Thanks,

Aaron
Hello,
 
I am working on a flow with two screens and a record create
 
1 Screen  - number “Quantity” field which the user will populate. 
2 Screen  – Dynamic Choice product field.  I would like this to be the correct product tier based on the quantity input value in screen 1
3 Record Create – Create product
 
We have 20 tiers and I would not like to have to make 20 decision elements for the output.  Can I possibly build a formula in the dynamic choice filter logic?
 
For example:
 
If Quantity = 40
Then output should be Tier 4
 
If Quantity is 100
Then output should be Tier 10
 
Thanks,
 
Aaron
 
Hello,
 
I have built a flow which will configure products and a button with visualforce on the opportunity.  I showed this to my manager and she now wants the button to be where the add products button is.  I tried to move the button but when I test it I get an error message.  I am not sure if it has to do with the flow or the visualforce button. 
 
Here is the visualforce code.
 
<apex:page standardController="Opportunity" Showchat="False" showheader="True" standardStylesheets="True">
    <apex:stylesheet value="{!$Resource.ProductConfig}"/>
     
    <Center><apex:image url="{!$Resource.Get_Logo}" width="500" height="100"/></Center>
   
         <flow:interview name="Tempered_Networks_Product_Configuration_Version_3" finishLocation="/{!$CurrentPage.parameters.id}">
                <apex:param name="varOpportunityID" value="{!Opportunity.Id}"/>
            </flow:interview>
               
</apex:page>
 
Does anyone know how I can update this to work on the opportunity product related list?
 
Thanks,
 
Aaron
 
 
Hello,
 
I am building a custom button with a flow and a visualforce on the opportunity object.  When the button is selected, the flow will create a new opportunity record.  I would like the finish screen to be on the newly created opportunity.  I have been doing some research and have asked the cloud for help.  I was told I need to create a custom controller which I have.  I think I have built everything correct but it is not working.  I might have something to do with my variables in my flow.  This is what I am working with.
 
Flow variables:
 
Record Lookup:  varOpportunityID
Record Create (Store new Opp info):  varNEWOppty
 
User-added image

User-added image

User-added image

Controller
 
Public class ExtensionName {

    Public Flow.Interview.Create_POV_Opportunity myAutoFlow { get; set; }
    Public ExtensionName(ApexPages.standardController controller) {}
    
    Public String getmyID() {
        if (myAutoFlow==null)
            return '';
        Else
            return myAutoFlow.varNEWOppty;
        }
    Public PageReference getNextPage(){     
    PageReference p = new PageReference('/' + getmyID() );
    p.setRedirect(true);
    return p;
    }
}

 
 
VisualForce Page
 
<apex:page standardController="Opportunity" extensions="ExtensionName" Showchat="False" showheader="True" standardStylesheets="True">
   
  
        <flow:interview name="Create_POV_Opportunity" interview="{!myAutoFlow}"  finishLocation="{!nextPage}">
                <apex:param name="varOpportunityID" value="{!Opportunity.Id}"/>
            </flow:interview>
    <apex:detail subject="{!Opportunity.Id}"/>
               
 
</apex:page>
 
 
I am not sure what I am missing.
 
Any help is much appreciated.
 
Thanks,
 
Aaron
 
Hello,
 
I am working on a flow which contains a screen and two dynamic choices.  Ideally when one of both dynamic choices are selected then I would like to create the records.  My flow works if both choices are selected and if the first one is selected.  When I only select the second choice then the record is not created. 
 
I have two decision elements. 
 
If the first choice is selected – create record
If the second choice is selected – create the second record
 
My flow breaks if the second choice is only selected because of the first decision element breaks the link.  I am not sure how to get around this.  Do I need to use the Loop element?
 
User-added image

Thanks,
 
Aaron
Hello,
 
I am working on a flow with a button on the opportunities.  When the button is selected it will generate a new opportunity.  However when the flow completes, the finish location is the current opportunity and not the newly created opp.  I have a visual force page on with the button and I would like to see if I can have the finish location to be the new created opp. 
 
Here is the variable for the new opp in the flow:  {!varNEWOppty}
 
And here is the visualforce page:
 
 <apex:page standardController="Opportunity" Showchat="False" showheader="True" standardStylesheets="True">
   
  
        <flow:interview name="Create_POV_Opportunity" finishLocation="/{!$CurrentPage.parameters.id}">
                <apex:param name="varOpportunityID" value="{!Opportunity.Id}"/>
            </flow:interview>
               
 
</apex:page>
 
Is this possible?
 
Thanks,
 
Aaron
 
Hello,
 
I would like to see if it is possible to build a validation rule in my flow which will force the user to populate a field if a choice field is populated.  I have a Product dynamic choice field which query’s on the products and a Quantity number field in a screen.  If the user selects a product then I would like the validation rule to force the user to populate the quantity. 
 
Here are the flow elements:
 
Dynamic Choice:  {!OptionProductsA100}
Quantity:  QuantityOptionA100
 
User-added image

Any help is much appreciated.
 
Thanks,
 
Aaron
Hello,
 
I am creating custom address fields on the opportunity object with the same fields as the standard address fields with country and state picklist values.  I am looking to see if I can build a custom visual force popup window for the inline editing like the standard address features.  Is this possibile and if so how would I go about doing this?
 
Thanks,
 
Aaron
 
Hello,
 
I am trying to build a product configurator using a flow and would like to build an “inclusion” rule.  The flow query’s on products using a dynamic choice.  When the user selects the product, then it will be added to the opportunity line items.  This part works but I would like to systematically add the associated support SKU to the line items.  I have created a custom object and lookup field to the products.  This object is labeled “Inclusion Products” which has the associated bundle product.  I need to figure out how to query on this object and product to populate on the opportunity line items.  I also need to query on the correct price book.
 
For example:
 
If the user selects 100-E for Ethernet rated at 10 Mbps throughput  product as the dynamic choice then I would like the associated HS-SW-100-E-GOLD

Any Help is much appreciated.

Here are some screenshots

User-added image

User-added image

User-added image

User-added image

User-added image
Hello,
 
I have been working with @ Michael White amd @Mayank Srivastava over the community site on how to add product line items using a custom button and flow.  With their help the Flow works and I am able to add products through a dynamic choice action.  Rather than continue to bother Mike and Mayank in the same thread I would like to see if I can add to this process. 
 
When using the button/flow the user is asked a few questions to narrow the product results.  When the user selects the product, the opportunity line item will be created.  I would like to see if I can automatically create another “Bundle” opportunity line item using the same flow.
 
For example: 
 
If the user selects the Software 100 (standard product)
The I would like the  Premium Support 100 (bundle product) to be created as well.
 
I started to build a custom related object on the product labeled Inclusion Product (Bundles).  In this object I am connecting the standard product to the bundle product with a lookup. 
 
I was thinking I could query on this associated bundle product in the flow but I am not sure how.
 
I know this is getting into a CPQ type of process but we are a startup with little budget.  Any advice is appreciated.
 
Thanks,
 
Aaron

User-added image
Hello,
 
I am working with the Flows and when I test it out I only have the “Next” button available on the screen elements.  Is there a way I can add a “Previous” and “Finish” button to the flow?  If so how can I do this?  I came across this site but it does not give me a step by step guide.
 
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_flows_customize_runtime_ui.htm
 
Any help is much appreciated.
 
Thanks,
 
Aaron

User-added image
Hello,
 
I am trying to build a type of “Guided Selling” feature to help our sales reps quote correctly.  I know a CPQ tool would work but we are a start up with a small budget.  I was hoping I could use a flow to accommodate the request. I would like to use the flow to have a few questions and once answered check boxes or a picklist of specific products will be populated.  When they select the products then it will create the opportunity line items. 
 
For example:
 
Screen Questions:
 
Product Model – picklist
Subscription
Perpetual
 
Hardware – picklist
100
200
300
400
 
If question 1 is “subscription” and question 2 is “100” then the next page I would like to display only the products which contain “100”in the Hardware section on the products.
 
From there the user should have the ability to select the product and once saved it will create an opportunity line Item.
 
Can this be done?
 
Thanks,
 
Aaron
Hello,

I am very new to coding and have no idea what I am doing.  I am trying to build an extension controler but I keep getting errors.  The latest error is as follows:

Error: Compile Error: expecting a semi-colon, found 'new' at line 21 column 11

Controller

public class OpportunityExtension {
  public Opportunity opp{get; set;}
  public String accountRank {get; set;}
  public OpportunityExtension(ApexPages.StandardController stdCltr) {
    opp = (Opportunity) stdCltr.getRecord();

  }
  public void saverecord() {
    udpate opp;
    udpate new Account(Id = opp.AccountId ; Account_Rank__c = opp.Account.Account_Rank__c );

    //or
    //udpate new Account(Id = opp.AccountId , Account_Rank__c = accountRank );

  }
  public List<SelectOption> getItems() {

    List<SelectOption> options = new List<SelectOption>();
    options.add(new SelectOption('','Select'));
    options.add(new SelectOption('Closed','Closed'));
    options.add(new SelectOption('New','New'));
    options.add(new SelectOption('Working','Working'));

    return options;
  }
}

Can someone please help me with this?  I am not sure what I am missing.  

Thanks in advance,

Aaron
Hello,
 
I am working on building a “Mass Edit Opps” visualforce button on the opportunity list views and I need some help with the visualforce page.  The page allows the user to edit multiple Opportunity fields and one Account field.  The opportunity field updates work but the one Account picklist field labeled “Account Rank” does not make the update on the account.  The field shows on the page but will not make the update when I hit save. 
 
How can I get this to work?  Any help is much appreciated
 
Here is the visualforce code

<apex:page standardController="Opportunity" recordSetVar="unused" sidebar="false">
<apex:includeScript value="{!$Resource.UtilJS}" />
<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlock >
Note: All modifications made on the page will be lost if Return button is clicked without clicking the Save button first. 
</apex:pageBlock>
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Return" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!selected}" var="opp" id="table">
<apex:column headerValue="Name">
<apex:inputField value="{!opp.name}"/>
</apex:column>

 <apex:column headerValue="Account Rank">

          <apex:inputField value="{!opp.account.Account_Rank__c}"/>


        </apex:column>


        
        <apex:column headerValue="Channel Partner">

          <apex:inputField value="{!opp.Channel_Partner__c}"/>

        </apex:column>

        <apex:column headerValue="Project Name">

          <apex:inputField value="{!opp.Project_Name__c}"/>

        </apex:column>

        <apex:column headerValue="Evaluation Period - Start Date">

          <apex:inputField value="{!opp.Evaluation_Period_Start_Date__c}"/>

        </apex:column>

        <apex:column headerValue="Success Criteria for Evaluation">

          <apex:inputField value="{!opp.Success_Criteria_for_Evaluation__c}"/>

        </apex:column>

        <apex:column headerValue="Customer Pain Points">

          <apex:inputField value="{!opp.Customer_Pain_Points__c}"/>

        </apex:column>



<apex:column headerValue="Amount">
<apex:inputField required="true" value="{!opp.amount}"/>
</apex:column>

        <apex:column headerValue="Budget">

          <apex:inputField value="{!opp.Budget__c}"/>

        </apex:column>

        <apex:column headerValue="Close Date">

          <apex:inputField value="{!opp.closeDate}"/>

        </apex:column>

        <apex:column headerValue="Probability">

          <apex:inputField value="{!opp.Probability}"/>

        </apex:column>

        <apex:column headerValue="Weighted Revenue">

          <apex:inputField value="{!opp.Weighted_Revenue__c}"/>

        </apex:column>

        <apex:column headerValue="Champion">

          <apex:inputField value="{!opp.Champion__c}"/>

        </apex:column>

        <apex:column headerValue="Technical Issues">

          <apex:inputField value="{!opp.Technical_Issues__c}"/>

        </apex:column>

        <apex:column headerValue="Business Issues">

          <apex:inputField value="{!opp.Business_Issues__c}"/>

        </apex:column>

        <apex:column headerValue="Other Comments or Obstacles">

          <apex:inputField value="{!opp.Other_Comments_or_Obstacles__c}"/>

        </apex:column>

        <apex:column headerValue="Required Resources">

          <apex:inputField value="{!opp.Required_Resources__c}"/>

        </apex:column>

        <apex:column headerValue="SE Comments">

          <apex:inputField value="{!opp.SE_Comments__c}"/>

        </apex:column>


</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Hello,
 
I have built a flow which will configure products and a button with visualforce on the opportunity.  I showed this to my manager and she now wants the button to be where the add products button is.  I tried to move the button but when I test it I get an error message.  I am not sure if it has to do with the flow or the visualforce button. 
 
Here is the visualforce code.
 
<apex:page standardController="Opportunity" Showchat="False" showheader="True" standardStylesheets="True">
    <apex:stylesheet value="{!$Resource.ProductConfig}"/>
     
    <Center><apex:image url="{!$Resource.Get_Logo}" width="500" height="100"/></Center>
   
         <flow:interview name="Tempered_Networks_Product_Configuration_Version_3" finishLocation="/{!$CurrentPage.parameters.id}">
                <apex:param name="varOpportunityID" value="{!Opportunity.Id}"/>
            </flow:interview>
               
</apex:page>
 
Does anyone know how I can update this to work on the opportunity product related list?
 
Thanks,
 
Aaron
 
 
Hello,
 
I am working on a flow which contains a screen and two dynamic choices.  Ideally when one of both dynamic choices are selected then I would like to create the records.  My flow works if both choices are selected and if the first one is selected.  When I only select the second choice then the record is not created. 
 
I have two decision elements. 
 
If the first choice is selected – create record
If the second choice is selected – create the second record
 
My flow breaks if the second choice is only selected because of the first decision element breaks the link.  I am not sure how to get around this.  Do I need to use the Loop element?
 
User-added image

Thanks,
 
Aaron
Hello,

I am very new to coding and have no idea what I am doing.  I am trying to build an extension controler but I keep getting errors.  The latest error is as follows:

Error: Compile Error: expecting a semi-colon, found 'new' at line 21 column 11

Controller

public class OpportunityExtension {
  public Opportunity opp{get; set;}
  public String accountRank {get; set;}
  public OpportunityExtension(ApexPages.StandardController stdCltr) {
    opp = (Opportunity) stdCltr.getRecord();

  }
  public void saverecord() {
    udpate opp;
    udpate new Account(Id = opp.AccountId ; Account_Rank__c = opp.Account.Account_Rank__c );

    //or
    //udpate new Account(Id = opp.AccountId , Account_Rank__c = accountRank );

  }
  public List<SelectOption> getItems() {

    List<SelectOption> options = new List<SelectOption>();
    options.add(new SelectOption('','Select'));
    options.add(new SelectOption('Closed','Closed'));
    options.add(new SelectOption('New','New'));
    options.add(new SelectOption('Working','Working'));

    return options;
  }
}

Can someone please help me with this?  I am not sure what I am missing.  

Thanks in advance,

Aaron
Hello,
 
I am working on building a “Mass Edit Opps” visualforce button on the opportunity list views and I need some help with the visualforce page.  The page allows the user to edit multiple Opportunity fields and one Account field.  The opportunity field updates work but the one Account picklist field labeled “Account Rank” does not make the update on the account.  The field shows on the page but will not make the update when I hit save. 
 
How can I get this to work?  Any help is much appreciated
 
Here is the visualforce code

<apex:page standardController="Opportunity" recordSetVar="unused" sidebar="false">
<apex:includeScript value="{!$Resource.UtilJS}" />
<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlock >
Note: All modifications made on the page will be lost if Return button is clicked without clicking the Save button first. 
</apex:pageBlock>
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Return" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!selected}" var="opp" id="table">
<apex:column headerValue="Name">
<apex:inputField value="{!opp.name}"/>
</apex:column>

 <apex:column headerValue="Account Rank">

          <apex:inputField value="{!opp.account.Account_Rank__c}"/>


        </apex:column>


        
        <apex:column headerValue="Channel Partner">

          <apex:inputField value="{!opp.Channel_Partner__c}"/>

        </apex:column>

        <apex:column headerValue="Project Name">

          <apex:inputField value="{!opp.Project_Name__c}"/>

        </apex:column>

        <apex:column headerValue="Evaluation Period - Start Date">

          <apex:inputField value="{!opp.Evaluation_Period_Start_Date__c}"/>

        </apex:column>

        <apex:column headerValue="Success Criteria for Evaluation">

          <apex:inputField value="{!opp.Success_Criteria_for_Evaluation__c}"/>

        </apex:column>

        <apex:column headerValue="Customer Pain Points">

          <apex:inputField value="{!opp.Customer_Pain_Points__c}"/>

        </apex:column>



<apex:column headerValue="Amount">
<apex:inputField required="true" value="{!opp.amount}"/>
</apex:column>

        <apex:column headerValue="Budget">

          <apex:inputField value="{!opp.Budget__c}"/>

        </apex:column>

        <apex:column headerValue="Close Date">

          <apex:inputField value="{!opp.closeDate}"/>

        </apex:column>

        <apex:column headerValue="Probability">

          <apex:inputField value="{!opp.Probability}"/>

        </apex:column>

        <apex:column headerValue="Weighted Revenue">

          <apex:inputField value="{!opp.Weighted_Revenue__c}"/>

        </apex:column>

        <apex:column headerValue="Champion">

          <apex:inputField value="{!opp.Champion__c}"/>

        </apex:column>

        <apex:column headerValue="Technical Issues">

          <apex:inputField value="{!opp.Technical_Issues__c}"/>

        </apex:column>

        <apex:column headerValue="Business Issues">

          <apex:inputField value="{!opp.Business_Issues__c}"/>

        </apex:column>

        <apex:column headerValue="Other Comments or Obstacles">

          <apex:inputField value="{!opp.Other_Comments_or_Obstacles__c}"/>

        </apex:column>

        <apex:column headerValue="Required Resources">

          <apex:inputField value="{!opp.Required_Resources__c}"/>

        </apex:column>

        <apex:column headerValue="SE Comments">

          <apex:inputField value="{!opp.SE_Comments__c}"/>

        </apex:column>


</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Hi,
Does any one maybe came a cross of using the Visual Workflow as a assembly product configurator? My assembly product would be build from the components and each selection is depended from the previous selection. Below are my questions?
  1. On the first screen user will be typing the assembly product name and if there is already existing record shoudl be notified, if assembly is not existng should be taken through the configuration process of composing components as assembly product. Is it possible to achieve this functionality with Visual Workflow?
  2. When user is prompted to create new assembly product, the individual selections can be based on the previous one? e.g if selected blue colour should only get as an option to select only blue components?
  3. Each component record will include an individual component code, Is it possible to use formula that when the assembly product is configured formule will show all codes of the single components as a one long code?
I will appreciate any ideas or suggestions of how the similar functionality  was achieved.

Thanks
 

We have created a flow that creates an Opportunity and we want the "finishlocation" of the flow, where they end up when they click "Finish", to be the newly created Opportunity. I know that we will have to create a VF page and controller to pass the OpptyID (once created) back to the VF page and set as the finishlocation, but can't figure out how to do it. Any ideas?