• krishna p 28
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 8
    Questions
  • 2
    Replies
HI All,
Is it possible to schedule a report via developer console. I would like to know in which object does salesforce store the scheduled reports details. 
 
HI,
Whne logged in as user, SetUp>>My Settings >> Personal >> Advanced User Details, login history is not visible. As admin I can see User Login History as related list. Is there anything I have to enable?
Any help will be much appreciated.

Thanks,
Krishna
HI,
I am trying to load data into AccountShare and getting error : field integrity exception: RowCause (cannot insert sharing row with this cause)
Rowcause has different values like Owner, Team, ImplicitParent, Rule, Manual.
Any help to overcome this is appreciated.
HI,

I am new to integration. I have requirement of salesforce to salesforce integration. Multiple records (which are children of a parent) are to be maped to some fields of a single record of child of one object in org2. An external id field is common between two orgs to identify the parent. Can this be achieved with Salesforce to Salesforce integration? 

Thanks in Advance,
Krishna
HI,
I am using communities and sites together. I have customized login process.  I have few custom vf pages associated with community. I have added these vf pages under site as well. When I try to access any page directly by typing the community url + page name it is accessible. Is there any way to avoid this. If some one tries to access any custom page directly(.....like communityurl/custompagename), this should check for user log in. If user is not logged in, should be redirected to login page.

Regards,
Krishna 
HI,
For a guest user, in community portal, page is not redirecting to next page. These are custom pages for which I have custom controllers. In salesforce pages are redirecting well and functionality is working fine. But in portal, on button click the same page is reloaded without any action.
below is th ecode I am using ot redirect to next page,
pageReference pageref = new pageReference(siteUrl+sitePrefix+'/Custom_Page'+'?param='+id);

what might be the reason? 

Regards,
Krishna
HI,

I have written a wizard for 3 pages. Problem is with page redirection, in debug I cna see the apex call for page redirection is executed, but page is not redirecting.

public class ONC_CMT_RegistrationWizard
{

    public ONC_CMT_RegistrationWizard() {

    }

    private ApexPages.StandardController con{get;set;}
    Account account;
    APS_Survey_Questionaries__c surveyquestionaries;
    Survey_Result__c surveyresult;
    Survey_Response__c surveyresponse;
    
    //account object variables
    public string firstparam{get;set;}
    public string secondparam{get;set;}
    public string thirdparam{get;set;}
    public string fourthparam{get;set;}
    public string fifthparam{get;set;}
    public string sixthparam{get;set;}
    public string seventhparam{get;set;}
    public string eighthparam{get;set;}
    public string ninthparam{get;set;}
    public string tenthparam{get;set;}
    public string eleventhparam{get;set;}
    public string twelethparam{get;set;}
    public string thirteenthparam{get;set;}
    public string fourteenthparam{get;set;}     
    Public Boolean optIn1{ get;set; }//optin check box in Consent page
    public Boolean optIn2{ get;set; }//optin check box in Registration page
    
    //survey variables
    public String q1;
    public String q2;
    public String q3;
    public String q4;
    public String q5;
    public String diagnosismonth { get; set; }
    public String diagnosisyear { get; set; }
    public String Prescribed_taking_Medicine { get; set; }
    public String duration { get; set; }
    public String onlyMedicine { get; set; }
    public String engagedinCommunity { get; set; }
    
    public Account getAccount()
    {
        if(account == null)
        account = new Account();
        return account;
    }
    
    /*public Survey_Response__c getSurvey_Response__c()
    {
        if(surveyresponse == null)
        surveyresponse = new Survey_Response__c();
        return surveyresponse;
    }
    
    public Survey_Result__c get{
    if(surveyresult == null)
        surveyresult = new Survey_Result__c();
        return surveyresult;}
     //getSurvey_Result__c()
    
    */
    public ONC_CMT_RegistrationWizard(ApexPages.StandardController controller)
    {
        con = controller;
    }
    
    public PageReference step1()
    {
        //Page.ONC_CMT_Survey.setRedirect(false);
        return Page.ONC_CMT_survey;
        
    }
    
    public PageReference step2()
    {
        return Page.ONC_CMT_Registration_info;
    }
    
    private date dateconvert(string dat)
     {
         //String entereddate = ApexPages.currentPage().getParameters().get('thirdparam');
        List<String> myDate = dat.split('/');
        System.debug(mydate);
        Integer myIntDate = integer.valueOf(mydate[1]);
        Integer myIntMonth = integer.valueOf(mydate[0]);
        Integer myIntYear = integer.valueOf(mydate[2]);
        Date dt = Date.newInstance(myIntYear, myIntMonth, myIntDate);
        return dt;
     }
    
    Public PageReference save()
    {
        try{
        string entereddate = ApexPages.currentpage().getParameters().get('thirdparam');
        RecordType rt = [select Id from RecordType where Name = 'Patients' and SobjectType = 'Account' limit 1];
        System.debug('############'+rt.Id);
        //System.debug(''+);
        
       // account.RecordTypeId = rt.Id; 
        account.FirstName   = ApexPages.currentpage().getParameters().get('firstparam');
        account.LastName    = ApexPages.currentpage().getParameters().get('secondparam');
        account.APS_DOB__c  = dateconvert(entereddate);
        account.APS_Gender__c= ApexPages.currentpage().getParameters().get('fourthparam');
        account.BillingStreet = ApexPages.currentpage().getParameters().get('fifthparam');
        account.BillingCity = ApexPages.currentpage().getParameters().get('sixthparam');
        account.ShippingStreet = ApexPages.currentpage().getParameters().get('seventhparam');
        account.BillingState = ApexPages.currentpage().getParameters().get('eighthparam');
        account.BillingPostalCode = ApexPages.currentpage().getParameters().get('ninthparam');
        account.PersonEmail = ApexPages.currentpage().getParameters().get('tenthparam');
        account.Password__c = ApexPages.currentpage().getParameters().get('twelethparam');
        account.ONC_Confirm_Password__c = ApexPages.currentpage().getParameters().get('thirteenthparam');
        account.PersonMobilePhone = ApexPages.currentpage().getParameters().get('fourteenthparam');
        account.APS_Preferred_Contact_Method__c = 'Email';
        account.ONC_CMT_Opt_In_1__c = optin1;//use apex:inputField in page; insert account for 2 checkboxes
        account.ONC_CMT_Opt_In_2__c = optin2;
        
        insert account;
        
        q1 = q1.substring(4);
        q2 = q2.substring(4);
        q3 = q3.substring(4);
        q4 = q4.substring(4);
        q5 = q5.substring(4);
        System.debug('Qusetion 1 without leading chars'+q1);
        
        diagnosismonth = ApexPages.CurrentPage().getParameters().get('monthparam');
        System.debug('************'+diagnosismonth);
        diagnosisyear = ApexPages.CurrentPage().getParameters().get('yearparam');
        System.debug('************year'+diagnosisyear );
        Prescribed_taking_Medicine = ApexPages.CurrentPage().getParameters().get('prescribedparam');
        System.debug('************prescribed'+Prescribed_taking_Medicine );
        duration = ApexPages.CurrentPage().getParameters().get('durationparam');
        System.debug('************duration -Months'+duration );
        onlyMedicine = ApexPages.CurrentPage().getParameters().get('onlyparam');
        System.debug('************onlyMedicine  Yes/No'+onlyMedicine );
        engagedinCommunity = ApexPages.CurrentPage().getParameters().get('Engagedparam'); 
        System.debug('************engagedinCommunity -Yes/No'+engagedinCommunity );
         
        Integer month = Integer.valueOf(diagnosismonth);
        Integer year = Integer.valueOf(diagnosisyear);
        Date dt = Date.newInstance(year,month,0);
        
        //Survey_Result__c surveyresult = new Survey_Result__c();
        Map<string, string> sr = new Map<string, string>();
        sr.put(q1,String.ValueOf(dt));
        sr.put(q2,Prescribed_taking_Medicine);
        sr.put(q3,duration );
        sr.put(q4,onlyMedicine );
        sr.put(q5,engagedinCommunity);
        //System.debug('2nd Answer'+sqids.get(1));
        System.debug(sr.values());
        
        List<Survey_Result__c> surveyres = new List<Survey_Result__c>();
        Survey_Response__c sresponse = new Survey_Response__c(APS_SurveyName__c='My Survey',ONC_CMT_Account__c = account.id);
        insert sresponse;
        for(String idval:sr.keyset()){
            Survey_Result__c result=new Survey_Result__c();
            result.APS_Question__c = idval;
            result.APS_Answer__c = sr.get(idval);
             result.Survey_Response__c = sresponse.id;
            surveyres.add(result);
        }
        
        insert surveyres;
        
        PageReference completePage = new PageReference('/apex/ONC_CMT_Registration_complete');
        //completePage.setredirect(true);
        return completePage;
        }
        catch (Exception ex)
        {
            System.debug('All Exeptions Here'+ex.getStackTraceString());
        }
        return null;
    }
}
HI,
I have a requirement to maintain the view state of a page and carry the parameter to third page and insert this parameter along with other parameters of third page into account. I am using same controller for all three pages. Is there any way to make apex controller stateful or carry the parameters to 3rd page.

In second page I am capturing the parameters of child of account. I want these parameters also carrie dto third page. After inserting the account in 3rd page, I want to query the id of account and then insert the child object parameters captured in 2nd page and tie them to this account.

Is this approach correct?
Any thoughts or workarounds are highly appreciated.

Thanks in Advance.

Regards,
Krishna
HI,
For a guest user, in community portal, page is not redirecting to next page. These are custom pages for which I have custom controllers. In salesforce pages are redirecting well and functionality is working fine. But in portal, on button click the same page is reloaded without any action.
below is th ecode I am using ot redirect to next page,
pageReference pageref = new pageReference(siteUrl+sitePrefix+'/Custom_Page'+'?param='+id);

what might be the reason? 

Regards,
Krishna

Posting this in order to help others who, months from now, might Google "OP_WITH_INVALID_USER_TYPE_EXCEPTION" and find this explanation.

 

We wrote an Apex trigger on the User object, to insert a custom object record anytime a user updates their Chatter status.  This was done to fulfill a client's requirement to audit all Chatter activity.

 

The trigger worked fine, until one day the client signed up some Chatter Free users.  When such a user tried to update their status, they got a pop-up with an OP_WITH_INVALID_USER_TYPE_EXCEPTION error.

 

We scratched our collective heads for awhile.  After all, Apex triggers run in "system mode," right?  That is supposed to mean that "object and field-level permissions of the current user are ignored."  And yet this trigger seemed like it was running in "user mode," enforcing restrictions based on who the current user was.

 

The root cause turned out to be that a Chatter Free user cannot be the owner of a custom object record, and SFDC by default sets the current user as a new record's first owner.  We discovered this when we realized, via experiment, that Apex triggers fired as the result of actions by Chatter Free users could definitely update an existing record, but were having problems creating records.

 

So the simple solution was to explicitly set the owner of the new record to some fully-licensed user prior to inserting it.

Posting this in order to help others who, months from now, might Google "OP_WITH_INVALID_USER_TYPE_EXCEPTION" and find this explanation.

 

We wrote an Apex trigger on the User object, to insert a custom object record anytime a user updates their Chatter status.  This was done to fulfill a client's requirement to audit all Chatter activity.

 

The trigger worked fine, until one day the client signed up some Chatter Free users.  When such a user tried to update their status, they got a pop-up with an OP_WITH_INVALID_USER_TYPE_EXCEPTION error.

 

We scratched our collective heads for awhile.  After all, Apex triggers run in "system mode," right?  That is supposed to mean that "object and field-level permissions of the current user are ignored."  And yet this trigger seemed like it was running in "user mode," enforcing restrictions based on who the current user was.

 

The root cause turned out to be that a Chatter Free user cannot be the owner of a custom object record, and SFDC by default sets the current user as a new record's first owner.  We discovered this when we realized, via experiment, that Apex triggers fired as the result of actions by Chatter Free users could definitely update an existing record, but were having problems creating records.

 

So the simple solution was to explicitly set the owner of the new record to some fully-licensed user prior to inserting it.