HTML is showing in the aura component - salesforce

<aura:component implements="force:appHostable,lightning:isUrlAddressable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" controller="AccountController" access="global" >
<aura:attribute type="campaign[]" name="acctList"/>
<aura:attribute name="mycolumns" type="List"/>
<aura:handler name="init" value="{!this}" action="{!c.fetchAcc}"/>
<lightning:datatable data="{! v.acctList }"
columns="{! v.mycolumns }"
keyField="id"
hideCheckboxColumn="true"/>
</aura:component>

Could you use
<aura:unescapedHtml value=""/>

Related

Position Outlook Add-In button on the `AppointmentOrganizerCommandSurface`

I am trying to add a button to the AppointmentOrganizerCommandSurface in Outlook just like Giphy is added in this image, but instead, my My Office Add-in is added to the menu.
I would like to add an action button with my custom icon next to the Giphy action.
I tried manipulating manifest.xml. I went through the documentation and followed the steps, but I was unable to figure out what is going on.
Here is the manifest:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0" xsi:type="MailApp">
<Id>61262617-dad8-4e84-a9e4-89b1bab3e6e7</Id>
<Version>1.0.0.0</Version>
<ProviderName>Contoso</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="My Office Add-In"/>
<Description DefaultValue="A template to get started."/>
<IconUrl DefaultValue="https://localhost:3000/assets/icon-64.png"/>
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-128.png"/>
<SupportUrl DefaultValue="https://www.contoso.com/help"/>
<AppDomains>
<AppDomain>https://www.contoso.com</AppDomain>
</AppDomains>
<Hosts>
<Host Name="Mailbox"/>
</Hosts>
<Requirements>
<Sets>
<Set Name="Mailbox" MinVersion="1.1"/>
</Sets>
</Requirements>
<FormSettings>
<Form xsi:type="ItemRead">
<DesktopSettings>
<SourceLocation DefaultValue="https://localhost:3000/taskpane.html"/>
<RequestedHeight>250</RequestedHeight>
</DesktopSettings>
</Form>
</FormSettings>
<Permissions>ReadWriteItem</Permissions>
<Rule xsi:type="RuleCollection" Mode="Or">
<Rule xsi:type="ItemIs" ItemType="Message" FormType="Read"/>
</Rule>
<DisableEntityHighlighting>false</DisableEntityHighlighting>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<Requirements>
<bt:Sets DefaultMinVersion="1.3">
<bt:Set Name="Mailbox"/>
</bt:Sets>
</Requirements>
<Hosts>
<Host xsi:type="MailHost">
<DesktopFormFactor>
<FunctionFile resid="Commands.Url"/>
<ExtensionPoint xsi:type="AppointmentOrganizerCommandSurface">
<OfficeTab id="TabDefault">
<Group id="msgReadGroup">
<Label resid="GroupLabel"/>
<Control xsi:type="Button" id="msgReadOpenPaneButton">
<Label resid="TaskpaneButton.Label"/>
<Supertip>
<Title resid="TaskpaneButton.Label"/>
<Description resid="TaskpaneButton.Tooltip"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="Icon.16x16"/>
<bt:Image size="32" resid="Icon.32x32"/>
<bt:Image size="80" resid="Icon.80x80"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="Taskpane.Url"/>
</Action>
</Control>
<Control xsi:type="Button" id="ActionButton">
<Label resid="ActionButton.Label"/>
<Supertip>
<Title resid="ActionButton.Label"/>
<Description resid="ActionButton.Tooltip"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="Icon.16x16"/>
<bt:Image size="32" resid="Icon.32x32"/>
<bt:Image size="80" resid="Icon.80x80"/>
</Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>action</FunctionName>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="Icon.16x16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
<bt:Image id="Icon.32x32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="Commands.Url" DefaultValue="https://localhost:3000/commands.html"/>
<bt:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="GroupLabel" DefaultValue="Contoso Add-in"/>
<bt:String id="TaskpaneButton.Label" DefaultValue="Show Taskpane"/>
<bt:String id="ActionButton.Label" DefaultValue="Perform an action"/>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="TaskpaneButton.Tooltip" DefaultValue="Opens a pane displaying all available properties."/>
<bt:String id="ActionButton.Tooltip" DefaultValue="Perform an action when clicked."/>
</bt:LongStrings>
</Resources>
</VersionOverrides>
</OfficeApp>
Thank you in advance.
You need to pin your add-in in the outlook to acheive the same.
You can pin an add-in so it's easily available when you're composing an email message.
Select Settings> View all Outlook settings > Mail > Customize actions.
Select the check box for the add-in that you want to see when you’re composing a message.

Referance a static resource via aura:attribute

I have created a new component and I want to be able to pass an image from a static resource and a custom label via aura:attribute. This is what I tried and it does not work. How can I make the image/text to show?
<aura:attribute name="profileImage" type="string" default="Standard_Profile" />
<aura:attribute name="categoryName" type="string" default="Standard_Name" />
<img src="{!$Resource + !v.profileImage}" alt="profile pic"/>
<h3>{!$Label.'categoryName'}</h3>
I am very new to Salesforce.
Map the values from your custom label and static resource as default values in the attributes and use it in the code
<aura:component implements="flexipage:AvailableForAllPageTypes">
<aura:attribute name="profileImage" type="string" default="{!$Resource.profileImage}" />
<aura:attribute name="categoryName" type="string" default="{!$Label.c.categoryName}" />
<!-- Stand-alone static resources image file-->
<img src="{!v.profileImage}"/>
<!-- custom label -->
<div>
{!v.categoryName}
</div>
</aura:component>

Getting junk character in C structure after parsing

I am using a simple xml file.
<COMPANY>
<EMPLOYEES>
<EMPLOYEE>
<NAME>BOB</NAME>
<EMPID>51211</EMPID>
<SEX>M</SEX>
<DOB>10-1-1982</DOB>
<DOJ>12-7-2001</DOJ>
</EMPLOYEE>
</EMPLOYEES>
</COMPANY>
The xml booster meta definition file for the same is as below
<SYSTEM NAME="testmeta" >
<CCONFIG MAXLEN="100"
ARRAYSIZE="5"
FLATMODE="TRUE"/>
<ELEMENT NAME="COMPANY" TAG="COMPANY" MAIN="TRUE" >
<FIELDS>
<FIELD NAME="EMPLOYEES" REFTYPE="EMPLOYEE" MODE="DEFAULT" />
</FIELDS>
<FORMULA>
<ENCLOSED NAME="EMPLOYEES" >
<META NAME="COMMENT" >Target field is EMPLOYEES</META>
<REPEAT TARGET="EMPLOYEES" ATLEASTONE="TRUE" >
<ELEMENTREF NAME="EMPLOYEE" />
</REPEAT>
</ENCLOSED>
</FORMULA>
</ELEMENT>
<ELEMENT NAME="EMPLOYEE" TAG="EMPLOYEE" >
<FIELDS>
<FIELD NAME="NAME" TYPE="STRING" />
<FIELD NAME="EMPID" TYPE="INTEGER" />
<FIELD NAME="SEX" TYPE="STRING" />
<FIELD NAME="DOB" TYPE="STRING" />
<FIELD NAME="DOJ" TYPE="STRING" />
</FIELDS>
<FORMULA>
<CONCAT>
<ENCLOSED NAME="NAME" >
<META NAME="COMMENT" >Target field is NAME</META>
<PCDATA TARGET="NAME" />
</ENCLOSED>
<ENCLOSED NAME="EMPID" >
<META NAME="COMMENT" >Target field is EMPID</META>
<PCDATA TARGET="EMPID" />
</ENCLOSED>
<ENCLOSED NAME="SEX" >
<META NAME="COMMENT" >Target field is SEX</META>
<PCDATA TARGET="SEX" />
</ENCLOSED>
<ENCLOSED NAME="DOB" >
<META NAME="COMMENT" >Target field is DOB</META>
<PCDATA TARGET="DOB" />
</ENCLOSED>
<ENCLOSED NAME="DOJ" >
<META NAME="COMMENT" >Target field is DOJ</META>
<PCDATA TARGET="DOJ" />
</ENCLOSED>
</CONCAT>
</FORMULA>
</ELEMENT>
</SYSTEM>
Generated a .c and .h file for the same using xmlbooster lite using following command
xmlblit.exe -C testmeta.xmlb
Now in my application in main function i m calling accept_COMPANY function and passing S_XMLB_CONTEXT context object. Function succeeds but when i print each employee value using
printf("%s, %d, %s, %s, %s", En->aNAME,
En->aEMPID,
En->aSEX,
En->aDOB,
En->aDOJ);
printf("\n");
i am getting junk characters printed, even for the integer aEMPID value.
I am using Visual studio 2010 to compile and run the C program.
Tried both Unicode and MultiByte project but no luck in getting the correct values.
I am getting output as
UOB, 78, M, j0-1-1982, 1t-7-2001
After debugging the generated .c file found that, the generator is setting unwanted values for PCDATA type field. For e.g. for NAME field after retrieving the name from XML, the code has the following statement
/* Regexp */
if (strlen(obj->aNAME) > 0)
(obj->aNAME)[0] = 'U';
Anyone faced similar situation?
Wrote to xmlbooster support got the following reply.
XMLBooster Lite only support Java ; C is only provided for evaluation purposes, as values are scrambled as you’ve noticed in your sample programs and in the generated code. You need to purchase XMLBooster Pro to generate production-level parsers in C.
Got the answer, hope this helps others too who are experimenting.

Hibernate mapping and merging

I have 2 classes like this :
Message(id, title, content)
MessageEmployee(id, messageId, employeeId, readFlag)
and 2 tables like this :
MESSAGE(mess_id, mess_title, mess_content)
MESSAGE_EMPLOYEE(mess_empl_id, mess_id, empl_id, read_fg)
Mapping files :
<hibernate-mapping package="core">
<class name="Message" table="MESSAGE">
<!-- class id -->
<id name="id" type="int" column="MESS_ID" length="11">
<generator class="native"/>
</id>
<property name="content" type="string" column="MESS_CONTENT" />
<property name="title" type="string" column="MESS_TITLE" />
</class>
</hibernate-mapping>
<hibernate-mapping package="core">
<class name="MessageEmployee" table="MESSAGE_EMPLOYEE">
<!-- class id -->
<id name="id" type="int" column="MESS_EMPL_ID" length="11">
<generator class="native"/>
</id>
<!-- employee -->
<many-to-one name="employee" class="core.Employee"
column="EMPL_ID" cascade="save-update,merge" lazy="false" />
<!-- message -->
<many-to-one name="message" class="core.Message"
column="MESS_ID" cascade="save-update,merge" lazy="false" />
<property name="readFlag" type="character" column="READ_FG" />
</class>
</hibernate-mapping>
Here is my problem :
let's say I already have a message in database, and I want to create a messageEmployee and save it.
Code snippet :
Message sent = new Message(content, title);
Employee e = employeeDao.loadEmployeeWithId(Integer.valueOf(to));
messageDao.merge(sent)
MessageEmployee m = new MessageEmployee(sent, e, null);
m.setReadFlag('N');
messageEmployeeDao.mergeMessageEmploye(m);
When I merge(messageEmployee), it creates a new message and a new messageEmployee in database, but I don't want it to create a new message.
I'm quite sure my mapping is wrong since I am no expert, so what could I change to get the behaviour I want ?
It will create a new Message object because you are not providing id in your message object sent. When you execute messageDao.merge(sent), the sent object doesn't have and id to merge with. It is pure transient object. Try loading it from database like Employee.

nHibernate Master Detail Deletion

I have a Master Detail relationship configured. The hbm file is below. When I run some code like this
Favourite favourite = favourites.Find(f => f.Id== id);
user.Favourites.Remove(favourite);
m_UserRepository.Save(ref user);
I get the error message
NHibernate.Exceptions.GenericADOException: could not delete collection rows: [Model.Entities.User.Favourites#249][SQL: SQL not available] ---> System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'UserId', table 'BE.Favourite'; column does not allow nulls. UPDATE fails.
Any suggestions on what this means please help.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Model.Entities" schema="BE" assembly="Model" default-lazy="false">
<class name="Model.Entities.User, Model" table="Users" >
<id name="UserId" column="UserId" type="int" unsaved-value="0">
<generator class="native" />
</id>
<property name="UserName" column="UserName" type="string" />
<bag name="Favourites" cascade="all" lazy="true">
<key column="UserId"/>
<one-to-many class="Model.Entities.Favourite, Model"/>
</bag>
</class>
</hibernate-mapping>
Have you tried setting inverse="true" on your bag?
You actually need a many-to-many relationship in this case:
<class name="User">
<id name="Id">
<generator class="native">
<param name="sequence">object_sequence</param>
</generator>
</id>
<version name="Version" />
<property name="Name" />
<set name="Roles" table="User_Favourite">
<key column="UserId"/>
<many-to-many column="FavouriteId" class="Favourite"/>
</set>
</class>
And the same on the other side: (*note the inverse="true")
<class name="Favourite">
<id name="Id">
<generator class="native">
<param name="sequence">object_sequence</param>
</generator>
</id>
<version name="Version" />
<property name="RoleName" />
<set name="Users" table="User_Favourite" inverse="true">
<key column="FavouriteId"/>
<many-to-many column="UserId" class="User"/>
</set>
</class>
From the NHibernate 2.0 Documentation:
Very Important Note: If the <key> column of a <one-to-many> association is declared NOT NULL, NHibernate may cause constraint violations when it creates or updates the association. To prevent this problem, you must use a bidirectional association with the many valued end (the set or bag) marked as inverse="true". See the discussion of bidirectional associations later in this chapter.
Finally, I'm unsure if you really want to use a bag here. One user can have the same favorite two or more times?
P.S.: Also, note that lazy="true" is the default behavior since NHibernate 1.2.
try changing your cascade rule to:
<bag name="Favourites" cascade="all,delete-orphan" lazy="true">
<key column="UserId" not-null="true"/>
<one-to-many class="Model.Entities.Favourite, Model"/>
</bag>

Resources