• Barracks
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 6
    Replies
Hi Guys,

I was wondering if someone can help me, I'm trying to run a test class for a simple Apex class the calls a Flow Interview.
It also implements schedulable.

How do I write a test class for this? I could not find any documentation for this sort of use cases.
 
global class TestHelloWorld implements Schedulable{

   global void execute(SchedulableContext sc) {
      Map<String, Object> params = new Map<String, Object>();
Flow.Interview.ReturnHelloWorld helloWorldFlow = new Flow.Interview.ReturnHelloWorld(params);
helloWorldFlow.start();
   }

}

 
Hi Guys,

Below is a simple loop that I'm trying to create in the Cloud Flow Designer:

For( each element in the collection)
{
  if(condition=true)
    { do something}
}

So I built this loop that gets a collection of 10 records and iterates on each one of them.
On each iteration,  there is a Decision element that checks a condition, if it's met - it goes to an Assignment object. if not , it suppose to move on to the next element on the collection.
User-added image

The problem that it's not working, the loop only runs one time.


My workaround was to add another Assignment element as seen in the screenshot below:
User-added image

How can I remove that second assignment element? Why is it even necessary? 

Thank you,

 
Hi All,

Can someone explain what's the difference between a Flow to an Interview?

Second question, where can I find the Flow's constructors documentation? I tried looking it up on the link below but didn't find it.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_flowinterview.htm?state=id

The reason that I that I'm asking is because I'm trying to instantiate a new flow but sfdc presents an error:
Error: Compile Error: Constructor not defined: [Flow.Interview.ReturnHelloWorld].<Constructor>() at line 5 column 50

Code:
global class TestHelloWorld2 implements Schedulable{

 global void execute(SchedulableContext sc) {
  Flow.Interview.ReturnHelloWorld helloWorldFlow = new Flow.Interview.ReturnHelloWorld();
  helloWorldFlow.start();
}

}

I read in other posts that I need to pass a Map object as a parameter for the constructor, but where can I find the offical document that says it?
Hi All,

I'm new to Apex programming and I ran into some problems and I hoped one of you could advise.

I'm trying to follow this article on how to call a visual cloud flow from Apex:
https://andyinthecloud.com/2014/10/26/calling-flow-from-apex/

I followed the instructions on the Hello World Example, I created a simple flow, opened the developer console and pasted the following:
 
// Call the Flow
Map<String, Object> params = new Map<String, Object>();
Flow.Interview.ReturnHelloWorld helloWorldFlow = new Flow.Interview.ReturnHelloWorld(params);
helloWorldFlow.start();

It worked great.

Then I wanted to create a new Apex class to store it.
I created a new Class and pasted the following:
public class Test {

// Call the Flow
Map<String, Object> params = new Map<String, Object>();
Flow.Interview.ReturnHelloWorld helloWorldFlow = new Flow.Interview.ReturnHelloWorld(params);
helloWorldFlow.start();
}

But got this error message: 
Error: Compile Error: Method must define a body at line 6 column 1

So here's my first question, why did it work on the Developer console without defining the method first?

Anyways, I added the method and here's the complete code:
public class Test {
// Call the Flow
Map<String, Object> params = new Map<String, Object>();
Flow.Interview.ReturnHelloWorld helloWorldFlow = new Flow.Interview.ReturnHelloWorld(params);
helloWorldFlow.start();

   public void start() {
      helloWorldFlow = new Flow.Interview.ReturnHelloWorld(params);
      helloWorldFlow .start();
   }

}

But the error persists!
What am I doing wrong? Clearly I'm missing something very obvious.

Thank you.
 
Hi Guys,
I just started to learn the Apex and SOQL syntax of SFDC and I'm trying to get a hold on the Workbench and how to retrieve data using SOQL.
So I wrote a simple query in SQL syntax and I need help to convert it to SOQL.

SELECT Table1.Name, Table2.Name
FROM Table1__c
JOIN (Table2__c)
ON (Table1.id=Table2.id)
WHERE Table1.creterionA__c = 'somthing' AND Table2.creterionB__c = 'something else' 
Hi,

I've been trying to learn and practise creating flows using the Cloud Flow Designer Workbook:
https://resources.docs.salesforce.com/sfdc/pdf/workbook_flow.pdf

So I created a similar flow to 'Calculate Discounts on Opportunities' (page 29) and it works great, but I require to activate it with a click of a button.
My question is how do I run the flow when the Case page loads automaticlly? I am using the defualt Case page and not a custom visualforce page.

Thanks
Hi Guys,

I was wondering if someone can help me, I'm trying to run a test class for a simple Apex class the calls a Flow Interview.
It also implements schedulable.

How do I write a test class for this? I could not find any documentation for this sort of use cases.
 
global class TestHelloWorld implements Schedulable{

   global void execute(SchedulableContext sc) {
      Map<String, Object> params = new Map<String, Object>();
Flow.Interview.ReturnHelloWorld helloWorldFlow = new Flow.Interview.ReturnHelloWorld(params);
helloWorldFlow.start();
   }

}

 
Hi Guys,
I just started to learn the Apex and SOQL syntax of SFDC and I'm trying to get a hold on the Workbench and how to retrieve data using SOQL.
So I wrote a simple query in SQL syntax and I need help to convert it to SOQL.

SELECT Table1.Name, Table2.Name
FROM Table1__c
JOIN (Table2__c)
ON (Table1.id=Table2.id)
WHERE Table1.creterionA__c = 'somthing' AND Table2.creterionB__c = 'something else' 
Hi,

I've been trying to learn and practise creating flows using the Cloud Flow Designer Workbook:
https://resources.docs.salesforce.com/sfdc/pdf/workbook_flow.pdf

So I created a similar flow to 'Calculate Discounts on Opportunities' (page 29) and it works great, but I require to activate it with a click of a button.
My question is how do I run the flow when the Case page loads automaticlly? I am using the defualt Case page and not a custom visualforce page.

Thanks

Hi All -

 

I am new, so please forgive my green - but I am having a perplexing problem in generating a Visual Force email template showing related lists for a custom object.

 

I CAN get a list of Cases related to an Account with no problem, but when I put in a custom object  (Child Relationship Name "Suppliers") which is also (Master-Detail) related to Account I get the following error: Error: Invalid field Suppliers for SObject Account

 

I have tried everything I can think of - using API name instead, appending "__c" to the end, but it seems that i can't make any lists at all with custom objects in this code.

 

Is there a restriction within this type of code that allows only lists with standard objects or is there something I'm missing?

 

Any help would be greatly appreciated. I am not good enough to make a custom Apex controller yet and a little under the gun to kluge something together.

 

Thanks much,

 

Lex

 

Below is relevant code:

 

 

<messaging:emailTemplate recipientType="Contact"
    relatedToType="Account"
    subject="Supplier report for Account: {!relatedTo.name}"
    replyTo="support@acme.com" >
<messaging:htmlEmailBody >   
<html>
    <body>
     <STYLE type="text/css">
           TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }
           TD  {font-size: 11px; font-face: verdana }
           TABLE {border: solid #CCCCCC; border-width: 1}
           TR {border: solid #CCCCCC; border-width: 1}
     </STYLE>
         <font face="arial" size="2">
      <p>Dear {!recipient.name},</p>
      <p>Below is a list of supplier records related to the account: {!relatedTo.name}.</p>
<table border="0" >
        <tr >
            <th>Action</th><th>Product</th><th>Status</th><th>Creator Email</th><th>BL date</th>
         </tr>
<apex:repeat var="cx" value="{!relatedTo.Suppliers}">
   <tr>
       <td><a href="https://na1.salesforce.com/{!cx.id}">View</a> |  
       <a href="https://na1.salesforce.com/{!cx.id}/e">Edit</a></td>
(...snip...)