• Dnyanesh Sable
  • NEWBIE
  • 10 Points
  • Member since 2017
  • Salesforce Developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Please give me solution. in below i have created componets and it's Code.
campingListForm.cmp
<aura:component > 
    <aura:attribute name="newItem" type="Camping_Item__c"
                    default="{ 'sobjectType': 'Camping_Item__c',
                             'Name': '',
                             'Quantity__c': 0,
                             'Price__c': 0,
                             'Packed__c': false }"/>
    <aura:registerEvent name="addItem" type="c:addItemEvent"/>
     
    <form class="slds-form--stacked">
        
        <div class="slds-form-element slds-is-required">
            <div class="slds-form-element__control">
                <ui:inputText aura:id="itemname" label="Name"
                              class="slds-input"
                              labelClass="slds-form-element__label"
                              value="{!v.newItem.Name}"
                              required="true"/> 
            </div>
        </div>
        
        <div class="slds-form-element slds-is-required">
            <div class="slds-form-element__control">
                <ui:inputNumber aura:id="quantity" label="Quantity"
                                class="slds-input"
                                labelClass="slds-form-element__label"
                                value="{!v.newItem.Quantity__c}"
                                required="true"/>
                
            </div>
        </div>
        
        <div class="slds-form-element">
            <div class="slds-form-element__control">
                <ui:inputCurrency aura:id="price" label="Price"
                                  class="slds-input"
                                  labelClass="slds-form-element__label"
                                  value="{!v.newItem.Price__c}"
                                  />
            </div>
        </div>
        
        <div class="slds-form-element">
            <ui:inputCheckbox aura:id="packed" label="Packed?"
                              class="slds-checkbox"
                              labelClass="slds-form-element__label"
                              value="{!v.newItem.Packed__c}"/>
        </div>
        
        <div class="slds-form-element">
            <ui:button label="Create Camping Item"
                       class="slds-button slds-button--brand"
                       press="{!c.submitForm}"/>
        </div>
        
    </form>
     
</aura:component>

campingListFormController.js
({
    
    submitForm: function(component, event, helper) {    
    if(helper.validateItemForm(component)){
         
        var newItem = component.get("v.newItem");
        helper.createItem(component, newItem);
    }  
        } 
})

campingListFormHelper.js
({
 addItem: function(component, newItem) {
    var addItem = component.getItem("addItem");
    addItem.setParams({ "item": item });
    addItem.fire();
            component.set("v.newItem",{ 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Quantity__c': 0,
                    'Price__c': 0,
                    'Packed__c': false } );
},
    

        validateItemForm: function(component) {
        
              // Simplistic error checking
        var validItem = true;

        // Name must not be blank
        var nameField = component.find("itemname");
        var itemname = nameField.get("v.value");
        if ($A.util.isEmpty(itemname)){
            validItem = false;
            nameField.set("v.errors", [{message:"Item name can't be blank."}]);
        }
        else {
            nameField.set("v.errors", null);
        }
        
        // Quantity must not be blank
        var quantityField = component.find("quantity");
        var quantity = nameField.get("v.value");
        if ($A.util.isEmpty(quantity)){
            validItem = false;
            quantityField.set("v.errors", [{message:"Quantity can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }
        // Price must not be blank
        var priceField = component.find("price");
        var price = priceField.get("v.value");
        if ($A.util.isEmpty(price)){
            validItem = false;
            priceField.set("v.errors", [{message:"Price can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }
            return (validItem);

    }
})

addItemEvent.evt
<aura:event type="COMPONENT">
    <aura:attribute name="item" type="Camping_Item__c"/>
</aura:event>




 
Please give me solution. in below i have created componets and it's Code.
campingListForm.cmp
<aura:component > 
    <aura:attribute name="newItem" type="Camping_Item__c"
                    default="{ 'sobjectType': 'Camping_Item__c',
                             'Name': '',
                             'Quantity__c': 0,
                             'Price__c': 0,
                             'Packed__c': false }"/>
    <aura:registerEvent name="addItem" type="c:addItemEvent"/>
     
    <form class="slds-form--stacked">
        
        <div class="slds-form-element slds-is-required">
            <div class="slds-form-element__control">
                <ui:inputText aura:id="itemname" label="Name"
                              class="slds-input"
                              labelClass="slds-form-element__label"
                              value="{!v.newItem.Name}"
                              required="true"/> 
            </div>
        </div>
        
        <div class="slds-form-element slds-is-required">
            <div class="slds-form-element__control">
                <ui:inputNumber aura:id="quantity" label="Quantity"
                                class="slds-input"
                                labelClass="slds-form-element__label"
                                value="{!v.newItem.Quantity__c}"
                                required="true"/>
                
            </div>
        </div>
        
        <div class="slds-form-element">
            <div class="slds-form-element__control">
                <ui:inputCurrency aura:id="price" label="Price"
                                  class="slds-input"
                                  labelClass="slds-form-element__label"
                                  value="{!v.newItem.Price__c}"
                                  />
            </div>
        </div>
        
        <div class="slds-form-element">
            <ui:inputCheckbox aura:id="packed" label="Packed?"
                              class="slds-checkbox"
                              labelClass="slds-form-element__label"
                              value="{!v.newItem.Packed__c}"/>
        </div>
        
        <div class="slds-form-element">
            <ui:button label="Create Camping Item"
                       class="slds-button slds-button--brand"
                       press="{!c.submitForm}"/>
        </div>
        
    </form>
     
</aura:component>

campingListFormController.js
({
    
    submitForm: function(component, event, helper) {    
    if(helper.validateItemForm(component)){
         
        var newItem = component.get("v.newItem");
        helper.createItem(component, newItem);
    }  
        } 
})

campingListFormHelper.js
({
 addItem: function(component, newItem) {
    var addItem = component.getItem("addItem");
    addItem.setParams({ "item": item });
    addItem.fire();
            component.set("v.newItem",{ 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Quantity__c': 0,
                    'Price__c': 0,
                    'Packed__c': false } );
},
    

        validateItemForm: function(component) {
        
              // Simplistic error checking
        var validItem = true;

        // Name must not be blank
        var nameField = component.find("itemname");
        var itemname = nameField.get("v.value");
        if ($A.util.isEmpty(itemname)){
            validItem = false;
            nameField.set("v.errors", [{message:"Item name can't be blank."}]);
        }
        else {
            nameField.set("v.errors", null);
        }
        
        // Quantity must not be blank
        var quantityField = component.find("quantity");
        var quantity = nameField.get("v.value");
        if ($A.util.isEmpty(quantity)){
            validItem = false;
            quantityField.set("v.errors", [{message:"Quantity can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }
        // Price must not be blank
        var priceField = component.find("price");
        var price = priceField.get("v.value");
        if ($A.util.isEmpty(price)){
            validItem = false;
            priceField.set("v.errors", [{message:"Price can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }
            return (validItem);

    }
})

addItemEvent.evt
<aura:event type="COMPONENT">
    <aura:attribute name="item" type="Camping_Item__c"/>
</aura:event>




 
Hi all,
I'm in a big trouble trying to find such a tool. Anyone knows a tool or a workaroud to do that?  The only thing I've thinked is using a trigger when an event is created that does somithing to emule sending an invite, like this:
public class SendEmail {
    public String sendTo { get; set; }
    public String Subject { get; set; }
    public Event objEvent{get;set;}
    public SendEmail() {}
    public sendInvite() {
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        String[] toAddresses = new String[] {sendTo};
        mail.setToAddresses(toAddresses);
        mail.setSubject(Subject);
        mail.setPlainTextBody('');
        Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
        attach.filename = 'meeting.ics';
        attach.ContentType = 'text/calendar;';
        attach.inline = true;
        attach.body = invite();
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] {attach});
        Messaging.SendEmailResult[] er = Messaging.sendEmail(new Messaging.Email[] {mail});
        return null;
    }
    private Blob invite() {
        String txtInvite = '';
 
        txtInvite += 'BEGIN:VCALENDAR\n';
        txtInvite += 'PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN\n';
        txtInvite += 'VERSION:2.0\n';
        txtInvite += 'METHOD:PUBLISH\n';
        txtInvite += 'X-MS-OLK-FORCEINSPECTOROPEN:TRUE\n';
        txtInvite += 'BEGIN:VEVENT\n';
        txtInvite += 'CLASS:PUBLIC\n';
        txtInvite += 'CREATED:20150709T083709Z\n';
        txtInvite += 'DTEND:20150709T010000Z\n';
        txtInvite += 'DTSTAMP:20150708T203709Z\n';
        txtInvite += 'DTSTART:20150709T000000Z\n';
        txtInvite += 'LAST-MODIFIED:20150708T203709Z\n';
        txtInvite += 'LOCATION:Online\n';
        txtInvite += 'PRIORITY:5\n';
        txtInvite += 'SEQUENCE:0\n';
        txtInvite += 'SUMMARY;';
        txtInvite += 'LANGUAGE=en-us:Meeting\n';
        txtInvite += 'TRANSP:OPAQUE\n';
        txtInvite += 'UID:4036587160834EA4AE7848CBD028D1D200000000000000000000000000000000\n';
        txtInvite += 'X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD><META NAME="Generator" CONTENT="MS Exchange Server version 08.00.0681.000"><TITLE></TITLE></HEAD><BODY><!-- Converted from text/plain format --></BODY></HTML>\n';
        txtInvite += 'X-MICROSOFT-CDO-BUSYSTATUS:BUSY\n';
        txtInvite += 'X-MICROSOFT-CDO-IMPORTANCE:1\n';
        txtInvite += 'END:VEVENT\n';
        txtInvite += 'END:VCALENDAR';
 
        return Blob.valueOf(txtInvite);
    }
}

If no tool is available, is there a way to automate this process? Thanks!