• Mktdev
  • NEWBIE
  • 130 Points
  • Member since 2010

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 48
    Questions
  • 57
    Replies
I am trying to publish event to canvas app but unable to do so.

Components
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    
    <!--<ltng:require scripts="/resource/canvas/canvasall.js"
             afterScriptsLoaded="{!c.jsLoaded}" />-->
    <ltng:require scripts="/canvas/sdk/js/36.0/publisher.js"
             afterScriptsLoaded="{!c.jsLoaded}" />
    <ltng:require scripts="/canvas/sdk/js/36.0/controller.js"/>
    
	<ui:button label="Framework Button" press="{!c.handleClick}"/>
<force:canvasApp developerName="NodeJS_app" canvasId="testing" />

</aura:component>


Controller
({
    jsLoaded: function(component, event, helper) {
        console.log('canvas ready to go');
    },
    handleClick : function(cmp, event) {
        console.log(Sfdc)
        Sfdc.canvas.publisher.publish({name : 'mynamespace.myevent',
                                        payload : {'fff':'ff'},
        								target : {canvas : 'testing'}});
    }
})
Error
Uncaught Action failed: c$rebootApp$controller$handleClick [Cannot read property 'publish' of undefined]


 

I am trying to update Parent and child object using Nest Query but child records are not getting saved.

 

Public List<Account> getAccount(){
list<Account> acc = [select Id, Name,Country, (select Id, FirstName,LastName,Email from contact) from account where Id=: a.Id];
return acc;
}

 

<apex:repeat var="a" value="{!Account}">
    <apex:outputText value="{!a.Name}"/>
      <apex:repeat var="c" value="{!a.Contacts}">
        <apex:inputfield value="{!c.FirstName}">
        <apex:inputfield value="{!c.LastName}">
        <apex:inputfield value="{!c.Email}">
      </apex:repeat>
<apex:repeat>

 

Hi,

 

I am trying to update record. I tried both PATCH and POST as instructed in document but its not working.

 

when used Patch then I get "Invalid HTTP method: PATCH"

when I used POST then I get 

"message" : "HTTP Method 'POST' not allowed. Allowed are HEAD,GET,PATCH,DELETE",
  "errorCode" : "METHOD_NOT_ALLOWED"

 

Can anyone help? Below the code

 

 

HttpRequest req = new HttpRequest(); 
req.setEndpoint('https://ap1.salesforce.com'+'/services/data/v26.0/sobjects/Contact/0039000000Jzxts');
  req.setHeader('Authorization', 'OAuth ' + UserInfo.getSessionId()); 
  req.setHeader('X-PrettyPrint', 'true');
  req.setHeader('Content-Type','application/json');
  req.setBody('{"FirstName":"Mktg"}');
  req.setMethod('PATCH');
    
    
   system.debug('URL---'+UserInfo.getSessionId());
 
   Http http = new Http();
       HTTPResponse res = http.send(req);

 

 

Hi,

 

I am trying to update user in a batch apex and when there is any error I am trying capture those and store in a custom object but I am getting Mixed DML operation error.

 

Here is the flow:

  • Contact Updated during the course of the day
  • All contacts are flagged for nightly processing
  • At the mid night my Batch apex picks up those contact and then verify existence of portal user for them.
  • If portal user exist and there is change in the email then i want to update username and email both
  • If any error occur like Username already exist, duplicate user etcs I want to track in custom object.

Please suggest.

 

Snip of code:

 

Batch Apex: 

 

Database.SaveResult[] updateResult = Database.update(lstUserToUpdate,false); 
ExpectionTrackingCls.getErrorStatus(lstUserToUpdate,updateResult); 

 

ExpectionTrackingCls

 

 

public static void getErrorStatus(List<User> lstUser,LIST<Database.SaveResult> dbSaveResult)
    {
        List<Errorlog__c> errObj=new List<Errorlog__c>();
        for(Database.SaveResult sr : dbSaveResult){ 
            if (sr.isSuccess()==false) 
            {              
				for(Database.Error err : errs)
				{
					Errorlog__c newErrorRecord = new Errorlog__c();
					newErrorRecord.name = lstUser[i].username;
					newErrorRecord.message__c = err.getMessage()+err.getStatusCode();
					errObj.add(newErrorRecord);
				}
            }
        }
	}

 

 

 

 

Here is the beginning of my test class wehre I'm setting up test records. I'm getting an error: "Error: Compile Error: unexpected token: 'Acct.ID' at line 11 column 107" 

 

Later in the code I can easily access User fields (U.id for example). Why can't I access Acct.Id? Is it because it is in SOQL statement?  Thanks!

 

//set up records
User U = [select id from USer limit 1];

//setup Account record 
Account Acct = ([select id, type__c from Account limit 1]);

Acct_Plan__c ap = ([select Id, Name, Account__c, Planning_Year__c from Acct_Plan__c where Account__c = Acct.Id]);

 

How do you get the System Permissions to be pulled?

 

I am working on building a Metadata deployment for our company, and part of the deployment includes creating several new profiles. We are trying to capture all of the permissions for these profiles, but can't seem to get the system permissions to match in our test runs.

 

I know that when you retrieve the profile object, what you get is dynamic, based on what other object you are retrieving. (see Chap 4 bullet 2 of the Migration Guide)

 

The Following System Permissions are different between our source and destination environment

 

Customize Application
Manage Connections
Manage Custom Report Types
Manage Dashboards
Manage Public Documents
Manage Public List Views
Manage Public Reports
Manage Public Templates
Manage Translation
Manage Users
Modify All Data
Reset User Passwords and Unlock Users
+ Send Email
Transfer Record
View All Data

 

 

note: + indicates added in the destination. All others are lost.

Hi,

 

I want to have one inline visualforce page with a button on case .when user click on button they should popup another visualforce page and on xlose of pop refresh the the parent page. same as lookup functionality.

 

 

 

regards,

mukesh

 

Hi,

 

Can we write javascript onload on visualforce email template.

 

 

Hi,

 

I want to override the Delete button to add addition step before deletion.

 

Account is related to an custom object

 

1) if user goes to delete the custom object relationship then

2) user should be promoted with a VF page where he has to lookup a contact to assign his cases to another user.

 

Query:

 

How can I get the Id of deleting record using overridding button?

 

 

Hi,

 

Any one have any idea how to use the Customer Portal Role Hierarchy.

 

Since Customer Portal role has three role executive,manager and user.Now suppose user having User role are creating case so if we assign a user with Manager role then he/she can see all cases raised by User Role users.

 

But I want that if a User Role user is Reporting to XYZ manager then only XYZ manager can see his cases not all the managers.

 

Manager1                                                            Manager2                                    Manager3

        |                                                                               |                                                    | 

User1,User2                                                       User3,User4                               User5,User6

 

Currently Manager1 can see user3,user4,user5 and user6 cases and same for other.

 

I tried using Manager field but that doesnot allow us to select portal user.

 

Thanks is advance!

 

Regards,

Mktg

 

 

 

 

Hi,

 

I have two map one is Contact Account and another is Contact User .I want to create another map by comparing these two and create a new map for Account User.

 

Please help.

 

Regards,

Mktg