-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
5Questions
-
4Replies
Chatter feed to allow user to upload only PDF file
I have a requirement that the user should be allow to upload only PDF files into chatter feed. Any suggestion pls.
Thanks
Thanks
-
- Gaurav Gulanjkar 18
- April 14, 2016
- Like
- 0
- Continue reading or reply
Deserializing a JASON in apex class
Hi all,
I am trying to deserialize a jason string in a class, like this :
Following is the JASON string :
"ansList": [ { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowKQAS", "Name": "Highly Satisfied" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowZQAS", "Name": "Does not work" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowUQAS", "Name": "Not Satisfied" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowPQAS", "Name": "Satisfied" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowFQAS", "Name": "Very Impressed" } ], "question": { "Id": "a228E000000CcvAQAS", "Name": "SQ-000007", "CP_Question__c": "The products offered in the stored", "CP_AnswerType__c": "5 Radio Buttons", "Survey__c": "a208E000000CfOzQAK", "Survey_Answers__r": [ { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowKQAS", "Name": "Highly Satisfied" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowZQAS", "Name": "Does not work" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowUQAS", "Name": "Not Satisfied" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowPQAS", "Name": "Satisfied" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowFQAS", "Name": "Very Impressed" } ] }, "strSelectedAnswer": "Very Impressed"
I get this error in the debug :
System.TypeException: Invalid conversion from runtime type List<ANY> to Map<String,ANY>
I am using JSON.deserializeUntyped and from the VF I am passing angular JS list to the remote function like :angular.toJson($scope.relatedQuesAnsList, true)
Can any one let me know the what i am doing wrong.
Reference
I am trying to deserialize a jason string in a class, like this :
@RemoteAction public static submit(String objString) { Map<String,Object> dataListMap = (Map<String,Object>)JSON.deserializeUntyped(objString); List<Object> dataList = (List<Object>)dataListMap.get('question'); for(Object objSobject : dataList){ Map<String, Object> p = (Map<String, Object>) objSobject; } }
Following is the JASON string :
"ansList": [ { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowKQAS", "Name": "Highly Satisfied" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowZQAS", "Name": "Does not work" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowUQAS", "Name": "Not Satisfied" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowPQAS", "Name": "Satisfied" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowFQAS", "Name": "Very Impressed" } ], "question": { "Id": "a228E000000CcvAQAS", "Name": "SQ-000007", "CP_Question__c": "The products offered in the stored", "CP_AnswerType__c": "5 Radio Buttons", "Survey__c": "a208E000000CfOzQAK", "Survey_Answers__r": [ { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowKQAS", "Name": "Highly Satisfied" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowZQAS", "Name": "Does not work" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowUQAS", "Name": "Not Satisfied" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowPQAS", "Name": "Satisfied" }, { "CP_SurveyQuestion__c": "a228E000000CcvAQAS", "Id": "a238E000000CowFQAS", "Name": "Very Impressed" } ] }, "strSelectedAnswer": "Very Impressed"
I get this error in the debug :
System.TypeException: Invalid conversion from runtime type List<ANY> to Map<String,ANY>
I am using JSON.deserializeUntyped and from the VF I am passing angular JS list to the remote function like :angular.toJson($scope.relatedQuesAnsList, true)
Can any one let me know the what i am doing wrong.
Reference
-
- Gaurav Gulanjkar 18
- March 10, 2016
- Like
- 0
- Continue reading or reply
Inputcheck box select/refresh data
Hi All,
I have a requirement where I need to show task list of a case on visualforce page with checkbox's for each task. When I select the tasks, On select of the check box I need to update the task status in the database and refresh the table back on the visualforce page. I have written the logic to display the task list on the VF. How can I update the database on select of the checkbox and refresh the page.
Controller:
Visualforce page:
Thanks,
Gaurav
I have a requirement where I need to show task list of a case on visualforce page with checkbox's for each task. When I select the tasks, On select of the check box I need to update the task status in the database and refresh the table back on the visualforce page. I have written the logic to display the task list on the VF. How can I update the database on select of the checkbox and refresh the page.
Controller:
public class RelatedTaskController { public List<taskWrapper> taskList {get; set;} public RelatedTaskController(){ getTasks(); } public List<taskWrapper> getTasks() { if(taskList == null) { taskList = new List<taskWrapper>(); for(Task c: [select Id, Owner.Name,Status,Subject from Task where WhatId =: '5008E000001EOg6QAG']) { taskList.add(new taskWrapper(c)); } } return taskList; } public class taskWrapper { public Task tsk {get; set;} public Boolean selected {get; set;} public taskWrapper(Task t) { tsk = t; selected = false; } } }
Visualforce page:
<apex:page controller="RelatedTaskController"> <apex:form > <apex:pageBlock > <apex:pageBlockTable value="{!taskList}" var="t" id="table"> <apex:column > <apex:inputCheckbox value="{!t.selected}"/> </apex:column> <apex:column value="{!t.tsk.Owner.Name}" /> <apex:column value="{!t.tsk.Subject}" /> <apex:column value="{!t.tsk.Status}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Thanks,
Gaurav
-
- Gaurav Gulanjkar 18
- January 21, 2016
- Like
- 0
- Continue reading or reply
Jquery dialog popup not working
Hi,
I have a custom details page button which pops out a visualforce page in an Iframe. I am using jquery postmessage and receivemessage to communicate between the cross domain. I am not able to understand how to debug the postmessage and receivemessage. I have two buttons "OK" and "Close". On click of "OK" I want to run a logic and upon "close" the popup should be closed and the parent record window should be displayed. Following is the code I am using reffered from the link (http://www.valnavjo.com/blog/modal-dialog-on-a-standard-salesforce-page/) :
I am using custom ORG URL
Custom button code :
{!REQUIRESCRIPT('/soap/ajax/26.0/connection.js')}
{!REQUIRESCRIPT('/js/functions.js')}
{!REQUIRESCRIPT('/resource/Jquery/Jquery/jquery-1.8.2.min.js')}
{!REQUIRESCRIPT('/resource/Jquery/Jquery/jquery-ui.min.js')}
{!REQUIRESCRIPT ('/resource/Jquery/Jquery/postmessage/jquery.ba-postmessage.min.js')}
{!REQUIRESCRIPT ('/resource/Jquery/Jquery/bbq/jquery.ba-bbq.min.js')}
requireCssFile('/resource/Jquery/Jquery/jquery-ui.min.css');
function requireCssFile(filename) {
var fileref = document.createElement('link');
fileref.setAttribute('rel', 'stylesheet');
fileref.setAttribute('type', 'text/css');
fileref.setAttribute('href', filename);
document.getElementsByTagName('head')[0].appendChild(fileref);
}
var j$ = jQuery.noConflict();
var iframeurl = '{!URLFOR("/apex/CPSolicitorReassignPopup")}';
var child_domain = iframeurl.substring(0, iframeurl.indexOf('/', 9));
var parent_domain = window.location.protocol + '//' + window.location.host+ '/' +'{!Case.Id}';
j$.receiveMessage(
function(e){
alert(e.data);
var cross_result = j$.deparam(e.data);
if (cross_result.action == 'Close') {
j$modalDialog.dialog('Close');
}
},
child_domain
);
var j$modalDialog = j$('<div></div>')
.html('<iframe id="iframeContentId" src="' + iframeurl + '?parent_domain=' + parent_domain + '" frameborder="0" height="100%" width="100%" marginheight="0" marginwidth="0" scrolling="no" />')
.dialog({
autoOpen: false,
title: 'Alert!',
resizable: false,
width:350,
height:200,
autoResize: true,
modal: true,
draggable: false
});
j$modalDialog.dialog('open');
Visualforce page :
<apex:page controller="CP_SolicitorReassignPopupController" sidebar="false" showHeader="false">
<head>
<apex:includeScript value="{!URLFOR($Resource.Jquery, '/Jquery/jquery-1.8.2.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.Jquery, '/Jquery/postmessage/jquery.ba-postmessage.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.Jquery, '/Jquery/bbq/jquery.ba-bbq.min.js')}"/>
<script type="text/javascript">
var j$ = jQuery.noConflict();
var parent_domain = '{!JSENCODE($CurrentPage.parameters.parent_domain)}';
alert('-Parent-'+parent_domain);
j$(document).ready(function() {
j$('input[id$=btnCloseModalDialog]').click(function(event) {
event.preventDefault();
closeModalDialog();
});
});
function closeModalDialog() {
var cross_result = new Object();
cross_result.action = 'Close';
j$.postMessage(
cross_result,
parent_domain,
parent
);
}
</script>
</head>
<apex:form >
<apex:panelGroup >
Please confirm as this action will close the current Instruction Case from the Solicitor and close any open tasks.
<br/><br/>
Once confirmed new Instruction page will be presented for you to reassign & confirm the instructions.
</apex:panelGroup>
<br/><br/><br/>
<div align="center" draggable="false" >
<apex:commandButton value="OK" style="align:center"/>
<apex:commandButton value="Close" style="align:center" id="btnCloseModalDialog"/>
</div>
</apex:form>
</apex:page>
I have a custom details page button which pops out a visualforce page in an Iframe. I am using jquery postmessage and receivemessage to communicate between the cross domain. I am not able to understand how to debug the postmessage and receivemessage. I have two buttons "OK" and "Close". On click of "OK" I want to run a logic and upon "close" the popup should be closed and the parent record window should be displayed. Following is the code I am using reffered from the link (http://www.valnavjo.com/blog/modal-dialog-on-a-standard-salesforce-page/) :
I am using custom ORG URL
Custom button code :
{!REQUIRESCRIPT('/soap/ajax/26.0/connection.js')}
{!REQUIRESCRIPT('/js/functions.js')}
{!REQUIRESCRIPT('/resource/Jquery/Jquery/jquery-1.8.2.min.js')}
{!REQUIRESCRIPT('/resource/Jquery/Jquery/jquery-ui.min.js')}
{!REQUIRESCRIPT ('/resource/Jquery/Jquery/postmessage/jquery.ba-postmessage.min.js')}
{!REQUIRESCRIPT ('/resource/Jquery/Jquery/bbq/jquery.ba-bbq.min.js')}
requireCssFile('/resource/Jquery/Jquery/jquery-ui.min.css');
function requireCssFile(filename) {
var fileref = document.createElement('link');
fileref.setAttribute('rel', 'stylesheet');
fileref.setAttribute('type', 'text/css');
fileref.setAttribute('href', filename);
document.getElementsByTagName('head')[0].appendChild(fileref);
}
var j$ = jQuery.noConflict();
var iframeurl = '{!URLFOR("/apex/CPSolicitorReassignPopup")}';
var child_domain = iframeurl.substring(0, iframeurl.indexOf('/', 9));
var parent_domain = window.location.protocol + '//' + window.location.host+ '/' +'{!Case.Id}';
j$.receiveMessage(
function(e){
alert(e.data);
var cross_result = j$.deparam(e.data);
if (cross_result.action == 'Close') {
j$modalDialog.dialog('Close');
}
},
child_domain
);
var j$modalDialog = j$('<div></div>')
.html('<iframe id="iframeContentId" src="' + iframeurl + '?parent_domain=' + parent_domain + '" frameborder="0" height="100%" width="100%" marginheight="0" marginwidth="0" scrolling="no" />')
.dialog({
autoOpen: false,
title: 'Alert!',
resizable: false,
width:350,
height:200,
autoResize: true,
modal: true,
draggable: false
});
j$modalDialog.dialog('open');
Visualforce page :
<apex:page controller="CP_SolicitorReassignPopupController" sidebar="false" showHeader="false">
<head>
<apex:includeScript value="{!URLFOR($Resource.Jquery, '/Jquery/jquery-1.8.2.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.Jquery, '/Jquery/postmessage/jquery.ba-postmessage.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.Jquery, '/Jquery/bbq/jquery.ba-bbq.min.js')}"/>
<script type="text/javascript">
var j$ = jQuery.noConflict();
var parent_domain = '{!JSENCODE($CurrentPage.parameters.parent_domain)}';
alert('-Parent-'+parent_domain);
j$(document).ready(function() {
j$('input[id$=btnCloseModalDialog]').click(function(event) {
event.preventDefault();
closeModalDialog();
});
});
function closeModalDialog() {
var cross_result = new Object();
cross_result.action = 'Close';
j$.postMessage(
cross_result,
parent_domain,
parent
);
}
</script>
</head>
<apex:form >
<apex:panelGroup >
Please confirm as this action will close the current Instruction Case from the Solicitor and close any open tasks.
<br/><br/>
Once confirmed new Instruction page will be presented for you to reassign & confirm the instructions.
</apex:panelGroup>
<br/><br/><br/>
<div align="center" draggable="false" >
<apex:commandButton value="OK" style="align:center"/>
<apex:commandButton value="Close" style="align:center" id="btnCloseModalDialog"/>
</div>
</apex:form>
</apex:page>
-
- Gaurav Gulanjkar 18
- December 29, 2016
- Like
- 0
- Continue reading or reply
Download knowledge articles
I have a scenario where I am displaying knowledge base articles in communities. I have a requirement where I need to show a download button and upload button. How can I go with this approach to achive above.
-
- Gaurav Gulanjkar 18
- December 04, 2015
- Like
- 0
- Continue reading or reply
I have created same fields for both contact object and opportunity object. I would like to automatically update the field values on opportunity object whenever I cretae new customer record.
I'm new to Apex and creating Triggers so hoping someone can help. Here's the scenario;
I have created same fields for both contact object and opportunity object. I would like to automatically update the field values on opportunity object whenever I cretae new customer record.
For this I have written the trigger with the event after insert. But I am getting error
Can anyone correct the below code plz….
trigger updateField on Contact (after insert) {
Set<Id> Ids= new Set<Id>();
for (Contact contact : Trigger.new)
{
Ids.add(customer.Id);
}
List<Contact> contactList = new List<Contact>([Select Id,First_name__c, Last_name_c FromContact where Id in :Ids]);
for(Contact temp : contactList )
{
Oppertunities oppor = new Oppertunities();
oppor.First_Name__c = temp. First_name__c,;
oppor.Last_Name_c = Last_name_c;
insert oppor;
}
I have created same fields for both contact object and opportunity object. I would like to automatically update the field values on opportunity object whenever I cretae new customer record.
For this I have written the trigger with the event after insert. But I am getting error
Can anyone correct the below code plz….
trigger updateField on Contact (after insert) {
Set<Id> Ids= new Set<Id>();
for (Contact contact : Trigger.new)
{
Ids.add(customer.Id);
}
List<Contact> contactList = new List<Contact>([Select Id,First_name__c, Last_name_c FromContact where Id in :Ids]);
for(Contact temp : contactList )
{
Oppertunities oppor = new Oppertunities();
oppor.First_Name__c = temp. First_name__c,;
oppor.Last_Name_c = Last_name_c;
insert oppor;
}
- sdjagdja wdguqwe
- December 18, 2015
- Like
- 0
- Continue reading or reply
Hi Friends,
Hi All,
By using soql we can retrieve the records 50,000, Now i have 60,000 records how to i can achive this.
Viswam.
By using soql we can retrieve the records 50,000, Now i have 60,000 records how to i can achive this.
Viswam.
- viswsanath
- December 18, 2015
- Like
- 0
- Continue reading or reply
Build a Battle Station App Trailhead Is not working for Namespace enabled DevOrg
I have found lots of error when practicing on this trainhead. It seems trialhead is not working if namespace are enabled.
There was an unhandled exception. Please reference ID: KDXDFLAT. Error: Faraday::ClientError. Message: INVALID_TYPE: select id from battle_station__c where name = 'TH ^ ERROR at Row:1:Column:16 sObject type 'battle_station__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
There was an unhandled exception. Please reference ID: KDXDFLAT. Error: Faraday::ClientError. Message: INVALID_TYPE: select id from battle_station__c where name = 'TH ^ ERROR at Row:1:Column:16 sObject type 'battle_station__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
- The Ajay Gupta
- December 18, 2015
- Like
- 0
- Continue reading or reply
Download knowledge articles
I have a scenario where I am displaying knowledge base articles in communities. I have a requirement where I need to show a download button and upload button. How can I go with this approach to achive above.
- Gaurav Gulanjkar 18
- December 04, 2015
- Like
- 0
- Continue reading or reply