• Pruthvi Kankunthala
  • NEWBIE
  • 50 Points
  • Member since 2015
  • Software Consultant
  • Absyz Software Consulting Private Limited

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 3
    Questions
  • 23
    Replies
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.
 
I have a question . Let's say that i have a controller and a visualforce page in a Managed package . Can I make the controller so that it accesses the Custom object in the Org ( in which the package has been installed ) without exposing the controller at all ?
Hi Everyone ,

I was developing a functionality where , if the Lead object has a photo ( used custom rich text area field ) , then on Lead Conversion whenever the Contact is created , the photo should flow from Lead to Contact's field ( another custom field in Contact object ) . As this cannot be done via configuration , as Lead conversion mapping doesn't allow rich text area fields to map , i wrote a trigger on Lead Object , and update the related contact . 

Now the problem is , although the photo is updated in the Contact's Custom field , it shows that "Unavailable Photo" . Can anyone help in solving in this ?
Hi Everyone ,

We are using Linvio Events for handling our events , fairs etc., . But we like to build a new Calendar and Filters page for the events . My question is Can Linvio allow to access their data in Customized Visualforce Pages ? If YES Can anyone give me some pointers to it ? 
I want to cover the below line in my test case but I am not able to do that. I have created the campaign ID and have set properly in Order_credit__c but in actual apex class the below query is not coverage in test cases.

In Test case:-

Before update Order_Credit__c:{RecordTypeId=012E00000005hDGIAY, Status__c=Submitted, Approval_Required_Reason__c=Test, Account__c=0012200000B6V66AAF, Id=a0A22000000GW5qEAG, Campaign__c=7012200000017LjAAI, Order_Type__c=Suggested}

When control goes to below code in actual class it doesnt find anything.

Code:

for(Order_Credit__c orderCredit: [SELECT id, Order_Type__c FROM Order_Credit__c WHERE Order_Campaign__c IN :campaignIdSet  AND Status__c = 'Submitted'])

NOTE: I can understand the data is generated locally and is available only in scope of that class but is there any way that I can cover the above query in test class.

Please help, thanks in advance.

-Abhishek
Vf page 
<apex:page Controller="TEstConteroller" sidebar="false" standardStylesheets="true" showheader="false" >
<apex:form >
    <apex:pageBlock title="CASE" >
  <apex:pageBlockSection >
  <label>Subject</label>
  <apex:inputtext value="{!Sub}" />
 <label>Description</label>
 <apex:inputtext value="{!Des}" />
<center> <apex:commandButton value="find" action="{!search}"  /></center>
 </apex:pageBlockSection>
 <apex:outputLabel >
   <c:PageBlockTableEnhancerADV targetPbTableIds="tableRecords" paginate="true" defaultPageSize="50" pageSizeOptions="50,100,200"/>
</apex:outputLabel>
 <apex:pageblockTable value="{!CaseList}" var="a" id="tableRecords" styleClass="list" border="1">
               <apex:column headerValue="CaseNumber">
     <apex:outputLink value="/{!a.id}">"{!a.CaseNumber}"</apex:outputLink>
</apex:column>
                  <apex:column headerValue="Priority"> {!a.Priority} </apex:column>     
                <apex:column headerValue="Origin"> {!a.Origin} </apex:column> 
                              <apex:column headerValue="Owner"> {!a.owner.Name} </apex:column> 
                        </apex:pageblockTable>
 </apex:pageBlock>

Controller
public class TEstConteroller
{
    public list<Case> caseList {get;set;}
     public string Des {get;set;}
         public string Sub{get;set;}

    public void search()
    {
        CaseList = new List<Case>();
for(Case act : [select id,CaseNumber , Priority,Origin,Case.owner.Name,Description,Subject,from Case ]) {
    if(act.Description.contains('Des') || act.Subject.contains('Sub')) {
        caseList.add(act);
    }
    
    }
}
}
 
 
Hi Friends ,

I have to Integrate Salesforce to External Services 

Throwing the Error Is "Internal Server Error",Status Code :500 " Htttpresponse

External Services Has asking the JSON Format  in this Place Creating the XML Format How To resolve this Could Please Help me.



global class ResponseclsforFIC{
@future(callout=true)
    public static void Responsefrom3rdparty(string syncid){
    try{
      String endPointURL = 'https://cacf-test.crm.us2.oraclecloud.com/crmCommonApi/resources/latest/accounts';
      String userName = 'kullayappa.adapala@config-consultants.com';
      String password = 'Kull@i12345';
      
      // Specify the required user name and password to access the endpoint 
      // As well as the header and header information 
      Blob headerValue = Blob.valueOf(userName + ':' + password);
      String authorizationHeader = 'BASIC ' +EncodingUtil.base64Encode(headerValue);

        DOM.Document resDoc = new DOM.Document();        
            // Send the request
        HttpRequest req = new HttpRequest();   
     //   req.setTimeout(120000);         
        req.setMethod('POST'); 
        req.setEndpoint(endPointURL);
        req.setHeader('Authorization', authorizationHeader);
        sfdcFICxmlcreator genrate = new sfdcFICxmlcreator();
        String xml = genrate.xmlgenrate(syncid);
        req.setHeader('content-type', 'application/vnd.oracle.adf.resourceitem+json; charset=utf-8');
        req.setBody(xml);
        
         System.Debug('......... Body ...........'+xml);
        Http http = new Http();
          
       Transient HttpResponse res = new HttpResponse();
        res = http.send(req); 
          //HttpResponse res = http.send(request);  
           res = http.send(req); 
        system.debug('res.......'+res.getbody());
        Contact sfintegrate = new Contact();
       
        sfintegrate.Accountid=syncid;
        sfintegrate.LastName='ramgopalvarma';
        sfintegrate.Request_Status__c=res.getStatus();
         sfintegrate.Status_Code__c=string.valueof(res.getStatusCode());
         
         system.debug('>>>>>>>>>>>'+syncid);
         system.debug('????????????'+string.valueof(res.getStatusCode()));
         if(sfintegrate.Status_Code__c!='200'){
         sfintegrate.FIC_response__c=res.getbody();
         }
         sfintegrate.Execution_time__c=string.valueof(System.now());
         sfintegrate.Request_Body__c=xml;
         insert sfintegrate ;
      }catch(Exception e){
      System.debug('Error::'+e.getMessage());
    }
  }
 }


Thanks
kullayappa
Hi everyone,
-I want to enter the date manually in a text field (10chr). I want to validate it as the date formate as below _ _/_ _/_ _ _ _.
Can anyone help me over here.
thanks in advance.
Regards,
mac.
Is there any method to export the attacments of custom object?
I understand that when 'pushing' Apex code from a Sandbox to Production using the Change Set mechanism, test code coverage must be 75% or greater. Does the same constraint apply when using the Force.com IDE(clicking the 'Deploy to Server' button and selecting Production as the Target Org) to 'push' Apex code changes from a Sandbox to Production? I've used the Force.com IDE to push Apex code changes between Sandboxes with no issues to report. Any help would be appreciated as this is urgent!!!!
I have downloaded it from the sales force site under data management ,dataloader for mac.
It installs but does not open...Need urgent ans..
Hi All,

Am new to salesforce and while going through the trailhead excercises I came across the below formula, am confused with the logic, could somebody please help me?
OR(
LEN(BillingCountry) = 1,
NOT(
CONTAINS(
"AF:AX:AL:DZ:AS:AD:AO:AI:AQ:AG:AR:AM:" &
"AW:AU:AZ:BS:BH:BD:BB:BY:BE:BZ:BJ:BM:BT:BO:" &
"BA:BW:BV:BR:IO:BN:BG:BF:BI:KH:CM:CA:CV:KY:" &
"CF:TD:CL:CN:CX:CC:CO:KM:CG:CD:CK:CR:CI:HR:" &
"CU:CY:CZ:DK:DJ:DM:DO:EC:EG:SV:GQ:ER:EE:ET:FK:" &
"FO:FJ:FI:FR:GF:PF:TF:GA:GM:GE:DE:GH:GI:GR:GL:" &
"GD:GP:GU:GT:GG:GN:GW:GY:HT:HM:VA:HN:HK:HU:" &
"IS:IN:ID:IR:IQ:IE:IM:IL:IT:JM:JP:JE:JO:KZ:KE:KI:" &
"KP:KR:KW:KG:LA:LV:LB:LS:LR:LY:LI:LT:LU:MO:MK:" &
"MG:MW:MY:MV:ML:MT:MH:MQ:MR:MU:YT:MX:FM:MD:MC:" &
"MC:MN:ME:MS:MA:MZ:MM:MA:NR:NP:NL:AN:NC:NZ:NI:" &
"NE:NG:NU:NF:MP:NO:OM:PK:PW:PS:PA:PG:PY:PE:PH:" &
"PN:PL:PT:PR:QA:RE:RO:RU:RW:SH:KN:LC:PM:VC:WS:" &
"SM:ST:SA:SN:RS:SC:SL:SG:SK:SI:SB:SO:ZA:GS:ES:" &
"LK:SD:SR:SJ:SZ:SE:CH:SY:TW:TJ:TZ:TH:TL:TG:TK:" &
"TO:TT:TN:TR:TM:TC:TV:UG:UA:AE:GB:US:UM:UY:UZ:" &
"VU:VE:VN:VG:VI:WF:EH:YE:ZM:ZW",
BillingCountry)))
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.
 
how to write trigger ,it should'nt allow more than 2 contacts for a single account
OWD of my org : Account - Private, Contact - Controlled by Parent.
I shared a Account manually to a portal user(Edit access). As a portal user, i could be able to edit my shared account. But when i try to view Contacts under the same Account, i'm getting IInsufficient Privileges Error. Don't know why i'm getting this error when its parent record is shared.
Hi Everyone,

In Batch Apex can anyone explain me what this <sObject> is needed for. what exactly it does...?

 
Having trouble with reports. I can´t find the option to create Report and DashBoard Folders, nor schedule Reports.
Does anyone knows how to do that?
I've this validation rule, which is supposed to fire if Resolution or Closed Reason is blank. But it is not firing when closed reason is entered and resolution is blank.All other criteria met and when the resolution is blank the validation rule is not firing even thougth there is an AND. Resolution is a pick list field and closed reason is a long text area field.Could someone let me know why is this happening?

AND 

OR 

$User.ProfileId = "00e80000001Sdk2", 
$User.ProfileId = "00e80000001SpCX" 
), 
ISBLANK(TEXT(Resolution__c)), 
ISBLANK(Closed_Reason__c), 
ISPICKVAL(Status, "Resolved"), 
ISBLANK(Owner:Queue.QueueName) 
)

 
Just finished all of the Trails, Modules and Projects that are available up to this point using 3 different Dev Orgs. (2/3/2016)

Keep them coming. More Trails/Modules/Projects on development would be great. (Lightining,Apex,Visual Force, Javascript, Integration and using the Developer Console)

Thanks for providing these valuable resources !
Hi Everyone ,

I was developing a functionality where , if the Lead object has a photo ( used custom rich text area field ) , then on Lead Conversion whenever the Contact is created , the photo should flow from Lead to Contact's field ( another custom field in Contact object ) . As this cannot be done via configuration , as Lead conversion mapping doesn't allow rich text area fields to map , i wrote a trigger on Lead Object , and update the related contact . 

Now the problem is , although the photo is updated in the Contact's Custom field , it shows that "Unavailable Photo" . Can anyone help in solving in this ?
Just finished all of the Trails, Modules and Projects that are available up to this point using 3 different Dev Orgs. (2/3/2016)

Keep them coming. More Trails/Modules/Projects on development would be great. (Lightining,Apex,Visual Force, Javascript, Integration and using the Developer Console)

Thanks for providing these valuable resources !

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.