Wednesday, May 15, 2019

Dynamics CRM 365 Error 'The Given Key is not present in dictionary'

As a Dynamics CRM developer we always come across the error saying that 'The Given Key is not present in dictionary'.

The reason we receive this error message because of below issues:-

When we try to get the attribute value from Entity object without checking the attribute.

String AccountNumber=objAccount["accountnumber"];  

The above line will throw error if ObjAccount doesn't contains this attributes. 

TO fix this we should always check attributes in Entity object then get the value.


String AccountNumber=objAccount["accountnumber"];
We can also use below code which will return null if attribute is not present in Entity object.
string AccountNumber=objAccount.GetAtrributeValue<String>("accountnumber");

Happy CRMing!

Friday, August 3, 2018

CRM dynamics Hiding Add Existing Subgrid (+) Button

We had the requirement to Hide Add existing button for one of the grid on the form. We have achieved above requirement using DOM explorer.

Due to multiple Enable/Display rule associated to this button it was hard to hide this button.

//Hiding Add Existing Activity Contacts Subgrid (+) Button

document.getElementById("subGrid_ActivityContacts_addImageButton").disabled = true;

document.getElementById("subGrid_ActivityContacts_addImageButton").style.visibility = "hidden";

document.getElementById("subGrid_ActivityContacts_addImageButton").style.display = "none";

If you need to Hide Add Existing button for any SubGrid, please replace Subgrid Button ID with your SubGrid ID. You Can get this ID from Developer tool of any browser.

Hope this Helps!

Happy CRMing!

CRM Dynamics 2013 Set Header Field Value

Often we need to set value of Header field in CRM 2013. XRM.Page object model doesn't support setting up value to header form.

We tried putting the field on main form and Header as well. Using XRM.Page setValue() to Main form field doesn't auto populate field value on Header form.

To overcome this problem we have used below code to set the value on Header field.

if (document.getElementById("header_new_membership_d")


document.getElementById("header_new_membership_d").innerText = membershipText;


Please note that above code is unsupported and not recommended by Microsoft. This code will not work if Microsoft makes changes to DOM for newer release.

Hope it helps!

Happy CRMing!

Sunday, March 12, 2017

Software Engineering Interview Question and Answer

Software Engineering - Post Test
  1. With respect to "Software Crisis", identify the CORRECT statement from the following.
    a)  Increase in program size and complexity led to cost reduction
    b) Increase in program size and complexity led to ease of maintenance
    c) Increase in program size and complexity led to early release                  
    d) Increase in program size and complexity led to failure at customers site                                                                                           answer : d
  2. Increase in size and complexity of software led to _________.
(i) difficulty in maintenance
(ii) time and cost slippage
(iii) failure at customer's site
(iv) Untraceable errors after delivery
options                                                                 answer : c
a) Only (i) and (iii)                            b) Only (i), (ii) and (iii)                   
c) (i), (ii), (iii) and (iv)                      d) (i), (ii) and (iv)                                             
  1. Identify the CORRECT statement from the following
    options                                                 answer : a
    a) Executable code is made during Software Construction phase              
    b) Assembling, Installation and End-user training are done during Requirement Analysis phase                 
    c) Code Tuning to enhance performance is done during High Level Design phase                              
    d) Control Structures are selected during Requirements Analysis phase
  2. The deliverable of System Engineering phase in Waterfall model of SDLC is ____________.
    a) unit test plan                                b) unit tested code                        
    c) user requirements                     d) unit test results           answer : c
  3. Match the SDLC models to their characteristics.
SDLC Models:
(i) Spiral Model
(ii) Prototyping Model
(iii) Waterfall Model     
(iv) RAD                    
Characteristics of the models:
(a) Less technical risks and scope for accommodating new requirements
(b) Requires good expertise in risk management
(c) Emphasizes short Developmental Cycle and suitable for projects with tight deadlines
(d) Limited or no scope for accommodating new requirements
a) (i) – (b), (ii) – (a), (iii) – (d), (iv) – (c)                   
b) (i) – (b), (ii) – (d), (iii) – (a), (iv) – (c)                                  
c) (i) – (d), (ii) – (c), (iii) – (b), (iv) – (a)                                   
d) (i) – (c), (ii) – (d), (iii) – (a), (iv) – (b)                                   answer : a
  1. In waterfall model of software development life cycle, find out the phase which immediately follows the testing phase?
    a) Coding                                             b) Requirement Analysis                             
    c) Detailed design                            d) Deployment                 answer : d
  2. The deliverable of requirement analysis phase in Waterfall Model of SDLC  is __________.
    a) integrated code                           b) system test plan                        
    c) integration test plan                  d) unit test plan                answer : b
  3. Which requirements elicitation technique is most applicable for low user base among the following?
    a) Interviews                                     b) Scenarios                      
    c) Questionnaires                            d) Brainstorming              answer : a
  4. Which of the following are the problems in using Natural language for requirements specification?
(i)   Lack of clarity
(ii)  Combining of requirements
(iii) Over flexible
(iv) Confusion
options                                                                                                 answer : c
a) Only (i) and (ii)                             b) Only (i), (ii) and (iii)                   
c) (i), (ii), (iii) and (iv)                      d) (i), (ii) and (iv)
  1. In the Object Oriented Analysis and Design model which of the following techniques helps in designing the model?
    a) Data flow Diagram                      b) Data dictionary                           
    c) ER diagram                                     d) Activity diagram          answer : d
  2. In the Object Oriented Analysis and Design model, by combining data and methods into _________.
    a) an object                                        b) a class                             
    c) an image                                         d) a structure                     answer : a
  3. Match the testing techniques to their definition.
Testing Techniques:
(i) Statement Coverage
(ii) Branch Coverage
(iii) Path Coverage    
(iv) Compound Conditional Coverage    
(a) All possible paths traversed at least once
(b) All combinations of condition values at every decision must be covered
(c) Each branch in the control flow must be traversed at least once
(d) Each statement must be executed at least once
a) (i) – (d), (ii) – (c), (iii) – (b), (iv) – (a)                   
b) (i) – (b), (ii) – (a), (iii) – (d), (iv) – (c)                                  
c) (i) – (d), (ii) – (c), (iii) – (a), (iv) – (b)                                   
d) (i) – (b), (ii) – (d), (iii) – (a), (iv) – (c)                                   answer : c
  1. Bottom Up approach is ___________ testing method.
    a) Integration                                    b) Unit                 
    c) System                                            d) Accepatance                 answer : a
  2. Match the test design methods to their definition.
Test design methods:
(i) Boundary Value Analysis
(ii) Equivalence Partitioning
(iii) Error Guessing  
(iv) Logic Coverage  
(a) Test cases are generated by intuition and experience
(b) Test cases are designed to cover all the logical paths
(c) Inputs are divided into different classes, so that if one member in a class is valid others are considered valid as well
(d) Test cases are chosen to explore the boundary off-by-one errors
a) (i) – (d), (ii) – (c), (iii) – (a), (iv) – (b)                   
b) (i) – (b), (ii) – (d), (iii) – (a), (iv) – (c)                                  
c) (i) – (d), (ii) – (c), (iii) – (b), (iv) – (a)                                   
d) (i) – (b), (ii) – (a), (iii) – (d), (iv) – (c)                                   answer : a
  1. Which of the following statement(s) is/are TRUE with respect to regression testing?
(i) Regression testing is performed after making a functional improvement to existing software
(ii) Regression testing is performed by re-running the existing test cases against the modified software
a) Only (i)                                            b) Only (ii)                          
c) Both (i) and (ii)                             d) Neither (i) nor (ii)       answer : c
  1. Which of the following is a Configuration Management tool?
    options                                                                 answer : a
    a) VSS (Visual Source Safe)                          b) Microsoft communicator        
    c) Advanced c++                                               d) Java                                 
  2. Which of the following helps to ensure good quality consistently?
(i) Following Proper Processes
(ii) Carryout Quality Control and Quality Assurance Activities
(iii) Use Defect Prevention Techniques
a) Only (i)                                            b) Only (ii) and (iii)                          
c) Only (iii)                                           d) (i),(ii) and (iii)                answer :d
  1. Which of the following are Quality Control activities?
(i)  Review
(ii) Testing
(iii) Training
a) Only (i) and (ii)                             b) Only (ii) and (iii)                          
c) Only (i) and (iii)                             d) (i),(ii) and (iii)                answer :a
  1. Which one of the following is the unit of "Effort" metric?
    a) FP (Function Points)                  b) Number of defects                   
    c) Person days                                   d) LOC (Lines of code)    answer : c
  2. Module A has 1000 lines of uncommented source code (1000 LOC). Module B has 1500 lines of uncommented source code (1500 LOC). Module A was implemented by Imran. Module B was implemented by Irfan. Imran took 50 person hours to implement module A. Irfan took 100 person hours to implement module B. Imran introduced 25 defects in module A. Irfan introduced 30 defects in module B. (Note: LOC stands for Lines of Code)
What is the Productivity value for Irfan with respect to the scenario given above?
options                                                                 answer :d
a) 1500 LOC/Person Hour             b) 20 LOC/Person Hour                 
c) 10 LOC/Person Hour                  d) 15 LOC/Person Hour