title: Revit Getting/Setting values from a param
body: <p>I need to get and set a new value for a bunch of params into a model in Revit, so Im trying to create an Addin for it, so I can get a JSON file and implement into the model. I Tried this code to get a test param, but it keeps returning null. I created the param into the family on revit to try this. I dont know if this is the problem.</p>
  <pre><code>public Result Execute(
        ExternalCommandData commandData,
        ref string message,
        ElementSet elements)
      {
          UIApplication uiapp = commandData.Application;
          UIDocument uidoc = uiapp.ActiveUIDocument;
          Application app = uiapp.Application;
          Document doc = uidoc.Document;
  
          Element e = SelectElement(uidoc, doc);
          Parameter parameter = e.LookupParameter(&quot;comment_test&quot;);
  
          using(Transaction t = new Transaction(doc, &quot;parameter&quot;))
          {
              t.Start(&quot;param&quot;);
              try
              {
                  parameter.Set(&quot;Test Comment&quot;);
              }
              catch { }
              t.Commit();
          }
  
  
  
  
          return Result.Succeeded;
      }
  
      //Select the element
      public Element SelectElement(UIDocument uidoc, Document doc)
      {
          Reference r = uidoc.Selection.PickObject(ObjectType.Element);
          Element el= uidoc.Document.GetElement(r);
  
          return el;
      }
  
      // Get the param value and return as string
      public string GetParameterValue(Parameter parameter)
      {
          switch (parameter.StorageType)
          {
              case StorageType.ElementId:
                  return parameter.AsElementId().IntegerValue.ToString();
  
              case StorageType.Integer:
              case StorageType.None:
              case StorageType.Double:
                  return parameter.AsValueString();
  
              case StorageType.String:
                  return parameter.AsString();
  
              default:
                  return &quot;&quot;;
  
          }
      }
  </code></pre>
  <p>In the same place that I get this code, I got another one that returns a built-in param, so I tried as I saw on the video, but it also return null on debug.</p>
  <pre><code>public Result Execute(
        ExternalCommandData commandData,
        ref string message,
        ElementSet elements)
      {
          UIApplication uiapp = commandData.Application;
          UIDocument uidoc = uiapp.ActiveUIDocument;
          Application app = uiapp.Application;
          Document doc = uidoc.Document;
  
          Element e = SelectElement(uidoc, doc);
          Parameter parametro = e.get_Parameter(BuiltInParameter.ALL_MODEL_DESCRIPTION);
          using(Transaction t = new Transaction(doc, &quot;parametro&quot;))
          {
              t.Start(&quot;param&quot;);
              try
              {
                  parametro.Set(&quot;Teste de Inserção de Comentário&quot;);
              }
              catch { }
              t.Commit();
          }
  
          return Result.Succeeded;
      }
  </code></pre>